Documentation ¶
Index ¶
- Constants
- func H4ToString(h4 []uint64) string
- func HashContractBytecode(code []byte) ([]uint64, error)
- func KeyCodeLength(ethAddr common.Address) ([]byte, error)
- func KeyContractCode(ethAddr common.Address) ([]byte, error)
- func KeyContractStorage(ethAddr common.Address, storagePos []byte) ([]byte, error)
- func KeyEthAddrBalance(ethAddr common.Address) ([]byte, error)
- func KeyEthAddrNonce(ethAddr common.Address) ([]byte, error)
- func ScalarToFilledByteSlice(s *big.Int) []byte
- func StringToh4(str string) ([]uint64, error)
- type Key
Constants ¶
const ( // LeafTypeBalance specifies that leaf stores Balance LeafTypeBalance leafType = 0 // LeafTypeNonce specifies that leaf stores Nonce LeafTypeNonce leafType = 1 // LeafTypeCode specifies that leaf stores Code LeafTypeCode leafType = 2 // LeafTypeStorage specifies that leaf stores Storage Value LeafTypeStorage leafType = 3 // LeafTypeSCLength specifies that leaf stores Storage Value LeafTypeSCLength leafType = 4 )
const ( // HashPoseidonAllZeroes represents the poseidon hash for an input with all // bits set to zero. HashPoseidonAllZeroes = "0xc71603f33a1144ca7953db0ab48808f4c4055e3364a246c33c18a9786cb0b359" )
Variables ¶
This section is empty.
Functions ¶
func H4ToString ¶
H4ToString converts array of 4 Scalars of 64 bits into an hex string.
func HashContractBytecode ¶
HashContractBytecode computes the bytecode hash in order to add it to the state-tree.
func KeyCodeLength ¶
KeyCodeLength returns the key of code length leaf: hk0: H([0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0]) key: H([ethAddr[0:4], ethAddr[4:8], ethAddr[8:12], ethAddr[12:16], ethAddr[16:20], 0, 4, 0], [hk0[0], hk0[1], hk0[2], hk0[3]]
func KeyContractCode ¶
KeyContractCode returns the key of contract code leaf: hk0: H([0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0]) key: H([ethAddr[0:4], ethAddr[4:8], ethAddr[8:12], ethAddr[12:16], ethAddr[16:20], 0, 2, 0], [hk0[0], hk0[1], hk0[2], hk0[3]]
func KeyContractStorage ¶
KeyContractStorage returns the key of contract storage position leaf: hk0: H([stoPos[0:4], stoPos[4:8], stoPos[8:12], stoPos[12:16], stoPos[16:20], stoPos[20:24], stoPos[24:28], stoPos[28:32], [0, 0, 0, 0]) key: H([ethAddr[0:4], ethAddr[4:8], ethAddr[8:12], ethAddr[12:16], ethAddr[16:20], 0, 3, 0], [hk0[0], hk0[1], hk0[2], hk0[3])
func KeyEthAddrBalance ¶
KeyEthAddrBalance returns the key of balance leaf: hk0: H([0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0]) key: H([ethAddr[0:4], ethAddr[4:8], ethAddr[8:12], ethAddr[12:16], ethAddr[16:20], 0, 0, 0], [hk0[0], hk0[1], hk0[2], hk0[3]])
func KeyEthAddrNonce ¶
KeyEthAddrNonce returns the key of nonce leaf: hk0: H([0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0]) key: H([ethAddr[0:4], ethAddr[4:8], ethAddr[8:12], ethAddr[12:16], ethAddr[16:20], 0, 1, 0], [hk0[0], hk0[1], hk0[2], hk0[3]]
func ScalarToFilledByteSlice ¶
ScalarToFilledByteSlice converts a *big.Int into an array of maxBigIntLen bytes.
func StringToh4 ¶
StringToh4 converts an hex string into array of 4 Scalars of 64 bits.