Skip to content

Commit

Permalink
fix commitments slot
Browse files Browse the repository at this point in the history
Signed-off-by: Jun Kimura <[email protected]>
  • Loading branch information
bluele committed Aug 23, 2024
1 parent 29cf77c commit 0555667
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion module/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import (
"github.com/hyperledger-labs/yui-relayer/core"
)

// keccak256(abi.encode(uint256(keccak256("ibc.commitment")) - 1)) & ~bytes32(uint256(0xff))
var IBCCommitmentsSlot = common.HexToHash("1ee222554989dda120e26ecacf756fe1235cd8d726706b57517715dde4f0c900")

type Prover struct {
chain *ethereum.Chain
config ProverConfig
Expand Down Expand Up @@ -144,7 +147,7 @@ func (pr *Prover) buildStateProof(path []byte, height int64) ([]byte, error) {
// calculate slot for commitment
slot := crypto.Keccak256Hash(append(
crypto.Keccak256Hash(path).Bytes(),
common.Hash{}.Bytes()...,
IBCCommitmentsSlot.Bytes()...,
))
marshaledSlot, err := slot.MarshalText()
if err != nil {
Expand Down

0 comments on commit 0555667

Please sign in to comment.