Skip to content

Commit

Permalink
fix: redistribution contract abi type change (#4382)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrekucci committed Nov 13, 2023
1 parent bf5eba5 commit 84c21f5
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/beekeeper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:
K3S_VERSION: "v1.22.17+k3s1"
REPLICA: 3
RUN_TYPE: "PR RUN"
SETUP_CONTRACT_IMAGE_TAG: "1.0.3"
SETUP_CONTRACT_IMAGE_TAG: "1.0.4"
BEELOCAL_BRANCH: "main"
BEEKEEPER_BRANCH: "master"
BEEKEEPER_METRICS_ENABLED: false
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ func (m *mockContract) Claim(context.Context, redistribution.ChunkInclusionProof
return common.Hash{}, nil
}

func (m *mockContract) Commit(context.Context, []byte, uint32) (common.Hash, error) {
func (m *mockContract) Commit(context.Context, []byte, uint64) (common.Hash, error) {
m.mtx.Lock()
defer m.mtx.Unlock()
m.callsList = append(m.callsList, commitCall)
Expand Down
2 changes: 1 addition & 1 deletion pkg/storageincentives/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ func (a *Agent) commit(ctx context.Context, sample SampleData, round uint64) err
return err
}

txHash, err := a.contract.Commit(ctx, obfuscatedHash, uint32(round))
txHash, err := a.contract.Commit(ctx, obfuscatedHash, round)
if err != nil {
a.metrics.ErrCommit.Inc()
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/storageincentives/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func (m *mockContract) Claim(context.Context, redistribution.ChunkInclusionProof
return common.Hash{}, nil
}

func (m *mockContract) Commit(context.Context, []byte, uint32) (common.Hash, error) {
func (m *mockContract) Commit(context.Context, []byte, uint64) (common.Hash, error) {
m.mtx.Lock()
defer m.mtx.Unlock()
m.callsList = append(m.callsList, commitCall)
Expand Down
4 changes: 2 additions & 2 deletions pkg/storageincentives/redistribution/redistribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Contract interface {
IsPlaying(context.Context, uint8) (bool, error)
IsWinner(context.Context) (bool, error)
Claim(context.Context, ChunkInclusionProofs) (common.Hash, error)
Commit(context.Context, []byte, uint32) (common.Hash, error)
Commit(context.Context, []byte, uint64) (common.Hash, error)
Reveal(context.Context, uint8, []byte, []byte) (common.Hash, error)
}

Expand Down Expand Up @@ -115,7 +115,7 @@ func (c *contract) Claim(ctx context.Context, proofs ChunkInclusionProofs) (comm
}

// Commit submits the obfusHash hash by sending a transaction to the blockchain.
func (c *contract) Commit(ctx context.Context, obfusHash []byte, round uint32) (common.Hash, error) {
func (c *contract) Commit(ctx context.Context, obfusHash []byte, round uint64) (common.Hash, error) {
callData, err := c.incentivesContractABI.Pack("commit", common.BytesToHash(obfusHash), common.BytesToHash(c.overlay.Bytes()), round)
if err != nil {
return common.Hash{}, err
Expand Down
8 changes: 4 additions & 4 deletions pkg/storageincentives/redistribution/redistribution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ func TestRedistribution(t *testing.T) {
var obfus [32]byte
testobfus := common.Hex2Bytes("hash")
copy(obfus[:], testobfus)
expectedCallData, err := redistributionContractABI.Pack("commit", obfus, common.BytesToHash(owner.Bytes()), uint32(0))
expectedCallData, err := redistributionContractABI.Pack("commit", obfus, common.BytesToHash(owner.Bytes()), uint64(0))
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -297,7 +297,7 @@ func TestRedistribution(t *testing.T) {
redistributionContractABI,
)

_, err = contract.Commit(ctx, testobfus, uint32(0))
_, err = contract.Commit(ctx, testobfus, 0)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -402,7 +402,7 @@ func TestRedistribution(t *testing.T) {
t.Run("invalid call data", func(t *testing.T) {
t.Parallel()

expectedCallData, err := redistributionContractABI.Pack("commit", common.BytesToHash(common.Hex2Bytes("some hash")), common.BytesToHash(common.Hex2Bytes("some address")), uint32(0))
expectedCallData, err := redistributionContractABI.Pack("commit", common.BytesToHash(common.Hex2Bytes("some hash")), common.BytesToHash(common.Hex2Bytes("some address")), uint64(0))
if err != nil {
t.Fatal(err)
}
Expand All @@ -424,7 +424,7 @@ func TestRedistribution(t *testing.T) {
redistributionContractABI,
)

_, err = contract.Commit(ctx, common.Hex2Bytes("hash"), uint32(0))
_, err = contract.Commit(ctx, common.Hex2Bytes("hash"), 0)
if err == nil {
t.Fatal("expected error")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/transaction/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ func (t *transactionService) UnwrapABIError(ctx context.Context, req *TxRequest,
if cErr == nil {
return err
}
err = fmt.Errorf("%w: %s", err, cErr)
err = fmt.Errorf("%w: %s", err, cErr) //nolint:errorlint

var derr rpc.DataError
if !errors.As(cErr, &derr) {
Expand Down

0 comments on commit 84c21f5

Please sign in to comment.