Comments (9)
Tx:
{
"result" : {
"confirmations" : 61,
"attributes" : [],
"blockhash" : "0x9dee58955691e110a7728d75fd80754bafa6ada20232c1f55a8087b4ff155793",
"sender" : "NRaKbRA5JAEJtfUgJJZzmeDnKvP3pJwKp1",
"netfee" : "62104",
"size" : 1466,
"hash" : "0x6463d87dc0a5c62716c109279c7ae9edbc40bfd0f2d63e17e6302e156cfce5a5",
"blocktime" : 1721940581287,
"script" : "DcYDeyJuYW1lIjoiU3BvbnNvciIsImV4dHJhIjpudWxsLCJzdXBwb3J0ZWRzdGFuZGFyZHMiOltdLCJhYmkiOnsibWV0aG9kcyI6W3sibmFtZSI6Il9kZXBsb3kiLCJwYXJhbWV0ZXJzIjpbeyJuYW1lIjoiZGF0YSIsInR5cGUiOiJBbnkifSx7Im5hbWUiOiJpc1VwZGF0ZSIsInR5cGUiOiJCb29sZWFuIn1dLCJyZXR1cm50eXBlIjoiVm9pZCIsIm9mZnNldCI6MCwic2FmZSI6ZmFsc2V9LHsibmFtZSI6ImdldE93bmVyIiwicGFyYW1ldGVycyI6W10sInJldHVybnR5cGUiOiJIYXNoMTYwIiwib2Zmc2V0Ijo0Miwic2FmZSI6dHJ1ZX0seyJuYW1lIjoib25ORVAxN1BheW1lbnQiLCJwYXJhbWV0ZXJzIjpbeyJuYW1lIjoiZnJvbSIsInR5cGUiOiJIYXNoMTYwIn0seyJuYW1lIjoiYW1vdW50IiwidHlwZSI6IkludGVnZXIifSx7Im5hbWUiOiJkYXRhIiwidHlwZSI6IkFueSJ9XSwicmV0dXJudHlwZSI6IlZvaWQiLCJvZmZzZXQiOjEwMSwic2FmZSI6ZmFsc2V9LHsibmFtZSI6InVwZGF0ZSIsInBhcmFtZXRlcnMiOlt7Im5hbWUiOiJuZWZGaWxlIiwidHlwZSI6IkJ5dGVBcnJheSJ9LHsibmFtZSI6Im1hbmlmZXN0IiwidHlwZSI6IlN0cmluZyJ9LHsibmFtZSI6ImRhdGEiLCJ0eXBlIjoiQW55In1dLCJy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Ib7GfZBVuezJw=="
}
],
"sysfee" : "1000098004",
"version" : 0,
"validuntilblock" : 4368939,
"vmstate" : "HALT",
"nonce" : 247359,
"signers" : [
{
"scopes" : "CalledByEntry",
"account" : "0x18f13748e08d53c9a164227e1a3e8d8d9e78193e"
}
]
},
"jsonrpc" : "2.0",
"id" : 1
}
Script (deployment):
INDEX OPCODE PARAMETER
0 PUSHDATA2 7b226e616d65223a2253706f6e736f72222c226578747261223a6e756c6c2c22737570706f727465647374616e6461726473223a5b5d2c22616269223a7b226d6574686f6473223a5b7b226e616d65223a225f6465706c6f79222c22706172616d6574657273223a5b7b226e616d65223a2264617461222c2274797065223a22416e79227d2c7b226e616d65223a226973557064617465222c2274797065223a22426f6f6c65616e227d5d2c2272657475726e74797065223a22566f6964222c226f6666736574223a302c2273616665223a66616c73657d2c7b226e616d65223a226765744f776e6572222c22706172616d6574657273223a5b5d2c2272657475726e74797065223a2248617368313630222c226f6666736574223a34322c2273616665223a747275657d2c7b226e616d65223a226f6e4e455031375061796d656e74222c22706172616d6574657273223a5b7b226e616d65223a2266726f6d222c2274797065223a2248617368313630227d2c7b226e616d65223a22616d6f756e74222c2274797065223a22496e7465676572227d2c7b226e616d65223a2264617461222c2274797065223a22416e79227d5d2c2272657475726e74797065223a22566f6964222c226f6666736574223a3130312c2273616665223a66616c73657d2c7b226e616d65223a22757064617465222c22706172616d6574657273223a5b7b226e616d65223a226e656646696c65222c2274797065223a22427974654172726179227d2c7b226e616d65223a226d616e6966657374222c2274797065223a22537472696e67227d2c7b226e616d65223a2264617461222c2274797065223a22416e79227d5d2c2272657475726e74797065223a22566f6964222c226f6666736574223a3130352c2273616665223a66616c73657d2c7b226e616d65223a22766572696679222c22706172616d6574657273223a5b5d2c2272657475726e74797065223a22426f6f6c65616e222c226f6666736574223a38382c2273616665223a66616c73657d5d2c226576656e7473223a5b7b226e616d65223a224465627567222c22706172616d6574657273223a5b7b226e616d65223a22757365726e616d65222c2274797065223a22537472696e67227d2c7b226e616d65223a226d657373616765222c2274797065223a22416e79227d5d7d5d7d2c227065726d697373696f6e73223a5b7b22636f6e7472616374223a22307866666664633933373634646261646464393763343866323532613533656134363433666161336664222c226d6574686f6473223a5b22757064617465222c2264657374726f79225d7d5d7d ("{\"name\":\"Sponsor\",\"extra\":null,\"supportedstandards\":[],\"abi\":{\"methods\":[{\"name\":\"_deploy\",\"parameters\":[{\"name\":\"data\",\"type\":\"Any\"},{\"name\":\"isUpdate\",\"type\":\"Boolean\"}],\"returntype\":\"Void\",\"offset\":0,\"safe\":false},{\"name\":\"getOwner\",\"parameters\":[],\"returntype\":\"Hash160\",\"offset\":42,\"safe\":true},{\"name\":\"onNEP17Payment\",\"parameters\":[{\"name\":\"from\",\"type\":\"Hash160\"},{\"name\":\"amount\",\"type\":\"Integer\"},{\"name\":\"data\",\"type\":\"Any\"}],\"returntype\":\"Void\",\"offset\":101,\"safe\":false},{\"name\":\"update\",\"parameters\":[{\"name\":\"nefFile\",\"type\":\"ByteArray\"},{\"name\":\"manifest\",\"type\":\"String\"},{\"name\":\"data\",\"type\":\"Any\"}],\"returntype\":\"Void\",\"offset\":105,\"safe\":false},{\"name\":\"verify\",\"parameters\":[],\"returntype\":\"Boolean\",\"offset\":88,\"safe\":false}],\"events\":[{\"name\":\"Debug\",\"parameters\":[{\"name\":\"username\",\"type\":\"String\"},{\"name\":\"message\",\"type\":\"Any\"}]}]},\"permissions\":[{\"contract\":\"0xfffdc93764dbaddd97c48f252a53ea4643faa3fd\",\"methods\":[\"update\",\"destroy\"]}]}") <<
969 PUSHDATA2 4e4546336e656f2d676f2d302e3130362e332d7072652d31362d6764613430663264650000000000000000000000000000000000000000000000000000000000000000001f68747470733a2f2f6769746875622e636f6d2f6e656f2d656e636c6176652f0001fda3fa4346ea532a258fc497ddaddb6437c9fdff067570646174650200000f00009c57030279260340419bf667ce70412d510830710c016f4ad9302404db3072686a6913ce5341e63f18844057040041f6b46be2700b710c016f4ad9302404db3073686b5041925de831726ad8240b6a4ad9302404db3071694057010034cf706841f827ec8c405700034057030341f6b46be270680c016f5041925de8314ad9302404db30716941f827ec8c2611794ad9302404db3072786a5037000040c70ba200
1268 PUSH2
1269 PACK
1270 PUSH15
1271 PUSHDATA1 6465706c6f79 ("deploy")
1279 PUSHDATA1 fda3fa4346ea532a258fc497ddaddb6437c9fdff ("Nj36aekV3CLybZQJ5NfjYoFgRXEzhV9GtS", "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd")
1301 SYSCALL System.Contract.Call (627d5b52)
from neo-go.
Manifest:
{
"name" : "Sponsor",
"supportedstandards" : [],
"extra" : null,
"permissions" : [
{
"methods" : [
"update",
"destroy"
],
"contract" : "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd"
}
],
"abi" : {
"methods" : [
{
"safe" : false,
"name" : "_deploy",
"offset" : 0,
"returntype" : "Void",
"parameters" : [
{
"name" : "data",
"type" : "Any"
},
{
"name" : "isUpdate",
"type" : "Boolean"
}
]
},
{
"parameters" : [],
"offset" : 42,
"returntype" : "Hash160",
"safe" : true,
"name" : "getOwner"
},
{
"safe" : false,
"name" : "onNEP17Payment",
"parameters" : [
{
"name" : "from",
"type" : "Hash160"
},
{
"type" : "Integer",
"name" : "amount"
},
{
"name" : "data",
"type" : "Any"
}
],
"offset" : 101,
"returntype" : "Void"
},
{
"returntype" : "Void",
"offset" : 105,
"parameters" : [
{
"name" : "nefFile",
"type" : "ByteArray"
},
{
"name" : "manifest",
"type" : "String"
},
{
"name" : "data",
"type" : "Any"
}
],
"name" : "update",
"safe" : false
},
{
"returntype" : "Boolean",
"offset" : 88,
"parameters" : [],
"safe" : false,
"name" : "verify"
}
],
"events" : [
{
"name" : "Debug",
"parameters" : [
{
"name" : "username",
"type" : "String"
},
{
"type" : "Any",
"name" : "message"
}
]
}
]
}
}
from neo-go.
INDEX OPCODE PARAMETER
0 INITSLOT 3 local, 2 arg <<
3 LDARG1
4 JMPIFNOT 7 (3/03)
6 RET
7 SYSCALL System.Storage.GetContext (9bf667ce)
12 STLOC0
13 SYSCALL System.Runtime.GetScriptContainer (2d510830)
18 STLOC1
19 PUSHDATA1 6f ("o")
22 DUP
23 ISTYPE Buffer (30)
25 JMPIF 29 (4/04)
27 CONVERT Buffer (30)
29 STLOC2
30 LDLOC0
31 LDLOC2
32 LDLOC1
33 PUSH3
34 PICKITEM
35 REVERSE3
36 SYSCALL System.Storage.Put (e63f1884)
41 RET
42 INITSLOT 4 local, 0 arg
45 SYSCALL System.Storage.GetReadOnlyContext (f6b46be2)
50 STLOC0
51 PUSHNULL
52 STLOC1
53 PUSHDATA1 6f ("o")
56 DUP
57 ISTYPE Buffer (30)
59 JMPIF 63 (4/04)
61 CONVERT Buffer (30)
63 STLOC3
64 LDLOC0
65 LDLOC3
66 SWAP
67 SYSCALL System.Storage.Get (925de831)
72 STLOC2
73 LDLOC2
74 ISNULL
75 JMPIF 86 (11/0b)
77 LDLOC2
78 DUP
79 ISTYPE Buffer (30)
81 JMPIF 85 (4/04)
83 CONVERT Buffer (30)
85 STLOC1
86 LDLOC1
87 RET
88 INITSLOT 1 local, 0 arg
91 CALL 42 (-49/cf)
93 STLOC0
94 LDLOC0
95 SYSCALL System.Runtime.CheckWitness (f827ec8c)
100 RET
101 INITSLOT 0 local, 3 arg
104 RET
105 INITSLOT 3 local, 3 arg
108 SYSCALL System.Storage.GetReadOnlyContext (f6b46be2)
113 STLOC0
114 LDLOC0
115 PUSHDATA1 6f ("o")
118 SWAP
119 SYSCALL System.Storage.Get (925de831)
124 DUP
125 ISTYPE Buffer (30)
127 JMPIF 131 (4/04)
129 CONVERT Buffer (30)
131 STLOC1
132 LDLOC1
133 SYSCALL System.Runtime.CheckWitness (f827ec8c)
138 JMPIFNOT 155 (17/11)
140 LDARG1
141 DUP
142 ISTYPE Buffer (30)
144 JMPIF 148 (4/04)
146 CONVERT Buffer (30)
148 STLOC2
149 LDARG0
150 LDLOC2
151 SWAP
152 CALLT 0000 ("\x00\x00")
155 RET
from neo-go.
@lock9, can this transaction be one of yours? I'm interested in how this manifest was produced, fixing the node side is rather trivial, but I don't see how this can happen in a regular compiler use flow.
from neo-go.
Hello @roman-khimov,
Yes, that's mine. Maybe it's my serialization / deserialization code that has caused this?
Note: Maybe it's unrelated (probably is), but I saw this error neo-project/neo#3439 when I tried to send a transaction using an incorrect network magic.
Nef serialization code:
export class ContractNef {
magic: number
compiler: string
script: Buffer
source: string
checksum: bigint
tokens: ContractMethodToken[]
constructor() {
this.magic = 0
this.compiler = ''
this.script = Buffer.alloc(0)
this.checksum = BigInt(0)
this.tokens = []
}
static fromBytes(nefBytes: Buffer): ContractNef {
const nef = new ContractNef()
let offset = 0
nef.magic = nefBytes.readUInt32LE(offset)
offset += 4
if (nef.magic !== 0x3346454e) {
throw new Error('NEF deserialization failure - invalid magic')
}
nef.compiler = nefBytes
.subarray(offset, offset + 64)
.toString('utf8')
.replace(/\0/g, '')
offset += 64
const sourceSizeBytes = nefBytes.readUInt8(offset)
offset += 1
if (sourceSizeBytes > 256) {
throw new Error(
'NEF deserialization failure - source field size exceeds maximum length of 256',
)
}
if (sourceSizeBytes !== 0) {
nef.source = nefBytes
.subarray(offset, offset + sourceSizeBytes)
.toString('utf8')
offset += sourceSizeBytes
}
const reserved = nefBytes.readUInt8(offset)
offset += 1
if (reserved !== 0) {
throw new Error('NEF deserialization failure - invalid reserved byte')
}
const tokenLength = nefBytes.readUInt8(offset)
offset += 1
for (let i = 0; i < tokenLength; i++) {
const tokenHash = nefBytes.subarray(offset, offset + 20)
offset += 20
const methodNameSize = nefBytes.readUInt8(offset)
offset += 1
const methodName = nefBytes
.subarray(offset, offset + methodNameSize)
.toString('utf8')
offset += methodNameSize
const parametersCount = nefBytes.readUInt16LE(offset)
offset += 2
const hasReturnValue = nefBytes.readUInt8(offset) === 1
offset += 1
const callFlags = nefBytes.readUInt8(offset)
offset += 1
const methodToken = new ContractMethodToken(
tokenHash.toString('hex'),
methodName,
parametersCount,
hasReturnValue,
callFlags,
)
nef.tokens.push(methodToken)
}
const reserved2 = nefBytes.readUInt16LE(offset)
offset += 2
if (reserved2 !== 0) {
throw new Error('NEF deserialization failure - invalid reserved byte')
}
const { value: scriptLength, size: varIntSize } = readVarInt(
nefBytes,
offset,
)
offset += varIntSize
nef.script = nefBytes.subarray(offset, offset + Number(scriptLength))
offset += Number(scriptLength)
nef.checksum = BigInt(nefBytes.readUInt32LE(offset))
return nef
}
toBytes(): Buffer {
const buffers: Buffer[] = []
const magicBuffer = Buffer.alloc(4)
magicBuffer.writeUInt32LE(this.magic)
buffers.push(magicBuffer)
const compilerBuffer = Buffer.alloc(64)
compilerBuffer.write(this.compiler, 'utf8')
buffers.push(compilerBuffer)
const sourceSizeBuffer = Buffer.alloc(1)
sourceSizeBuffer.writeUInt8(this.source.length)
buffers.push(sourceSizeBuffer)
if (this.source.length > 0) {
const sourceBuffer = Buffer.from(this.source, 'utf8')
buffers.push(sourceBuffer)
}
const reservedBuffer = Buffer.alloc(1, 0)
buffers.push(reservedBuffer)
const tokenLengthBuffer = Buffer.alloc(1)
tokenLengthBuffer.writeUInt8(this.tokens.length)
buffers.push(tokenLengthBuffer)
this.tokens.forEach((method) => {
const tokenHashBuffer = Buffer.from(method.hash, 'hex')
buffers.push(tokenHashBuffer)
const methodNameBuffer = Buffer.alloc(1)
methodNameBuffer.writeUInt8(method.name.length)
buffers.push(methodNameBuffer)
const methodNameBytes = Buffer.from(method.name, 'utf8')
buffers.push(methodNameBytes)
const parametersCountBuffer = Buffer.alloc(2)
parametersCountBuffer.writeUInt16LE(method.parametersCount)
buffers.push(parametersCountBuffer)
const hasReturnValueBuffer = Buffer.alloc(1)
hasReturnValueBuffer.writeUInt8(method.hasReturnValue ? 1 : 0)
buffers.push(hasReturnValueBuffer)
const callFlagsBuffer = Buffer.alloc(1)
callFlagsBuffer.writeUInt8(method.callFlags)
buffers.push(callFlagsBuffer)
})
const reserved2Buffer = Buffer.alloc(2, 0)
buffers.push(reserved2Buffer)
serializeScript(this.script, buffers)
const checksumBuffer = Buffer.alloc(4)
checksumBuffer.writeUInt32LE(Number(this.checksum))
buffers.push(checksumBuffer)
return Buffer.concat(buffers)
}
}
from neo-go.
It's all about the manifest. Compiler outputs valid manifest on its own (with all fields), but if you do some additional processing then empty values can get mangled.
from neo-go.
Hm. Could that be caused by mismatching NEF/manifest? Is the manifest generated when there are compilation errors? I saw some weird behavior when I tried to recompile and redeploy a contract with syntax errors.
Could concurrency cause that? I also recompile my files frequently (automatically)
Maybe I formated the manifest json (added indentation) before deploying it (I can't recall it)
from neo-go.
Maybe I formated the manifest json (added indentation) before deploying it (I can't recall it)
It's not indented, but it looks like it was edited somehow. Compiler always emits groups/trusts/features fields, but they're missing from the manifest.
from neo-go.
I didn't make those changes manually. I remember being confused about the permissions, but I'm sure I didn't change the manifest.
from neo-go.
Related Issues (20)
- aggressive memory usage HOT 1
- Panic in WS client in subscription mechanism HOT 1
- CLI mistake in aliases for compare-states
- Check state dump time for mainnet HOT 1
- Add support for arrays
- Support ranging over integers in compiler
- Replace SessionExpirationTime with something that uses time.Duration
- `wsReader` gets blocked in rpcclient
- Explore new DBs
- Why is block.Index always 0? HOT 4
- Port standbycommittee/seedlist getversion RPC extension
- Allow compilation with CompileFile if config file differs HOT 1
- neotest.CompileFile does not add sourceURL to nef
- `TestNEP11_ND_OwnerOf_BalanceOf_Transfer` fails on Mac
- Reduce the number of supported Go versions HOT 2
- Designation event extension HOT 3
- Base64URL support HOT 1
- Go 1.23 upgrade check list
- Add ability to customize `batchTime` and `batchSize` for transactions broadcaster
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neo-go.