Skip to content

Commit

Permalink
Fraud reporting (#1280)
Browse files Browse the repository at this point in the history
* [goreleaser]

* up to calling submitStateReport

* barebones report invalid state in snapshot. need to update root PR

* make contract interfaces return txs for submitter

* [goreleaser]

* Cleanup: setup in parallel

* staging: working on fraud_test notary signature

* WIP: working thru fraud test

* WIP: working test

* Cleanup: remove logs

* Cleanup: more logs

* Fix: throw error for int64 overflow in EncodeState()

* WIP: fraud attestation handling

* WIP: add TestReportAttestationNotOnSummit

* WIP: testing. not getting log for submitAttestation event

* WIP, getting error of datahash code 0x184fb2df0de4da8049867b20a0d8b823d4590d0f3c9881144e53690eb2f67fe7

* WIP: successfully submitting fraudulent attestation. now debugging guards report

* WIP: working TestReportAttestationNotOnSummit

* Cleanup: test, remove logs

* Cleanup: remove GetAttestationComputeHash(), instead calculate hash as input

* Cleanup: remove unnecessary TestEncodeChainGasParity for now

* Cleanup: remove init() used for debugging lightinbox.metadata.go

* Cleanup: de-functionalize slashAccusedAgent() for consistency

* WIP: adding submitAttestationReport

* working submitattestationreport

* WIP: getting a signature for the STATE report

* small changes before handoff

* WIP: verifyStateWithAttestation case impl

* Feat: add TestReportFraudulentStateInAttestation

* staging. added a getter to the bondingmanager

* working test for fraudulentstateinattestation

* WIP: add receipt type with encoder

* WIP: add TestInvalidReceipt and handleReceipt impl

* CLEANME: added checks to test and start with tips encoding parity

* WIP: working case 1 of agnetStatusUpdate

* WIP: opendispute handling

* Cleanup: guard impl

* Cleanup: remove checks from event parser methods

* start of db implementation

* fix

* fillbytes

* fix

* staging

* Cleanup: remove printing reverts

* WIP: add getTestGuard() helper

* working receipt fraud test

* Cleanup: add bumpTx helper

* Cleanup: utilize AgentFlagType enum for AgentStatus.Flag values

* Cleanup: use getTestGuard() helper in all tests

* Cleanup: remove unnecessary test code

* Feat: add DisputeStatus type, GetDisputeStatus() call to BondingManager

* Feat: guard checks dispute status before submitting state report

* Cleanup: remove embedded lightinbox

* Cleanup: Domain -> AgentDomain

* WIP: verify agent status before slashing

* working multiple state case

* start to sql queries for crosstable dispute handling

* WIP: implement db queries and logic for updateAgentStatus() call

* WIP: fix cyclic deps

* Fix: build errs

* Add db tests

* wip: crosstable

* passing TestGetUpdateAgentStatusParameters

* working crosstable testrs

* WIP: add updateAgentStatuses()

* Feat: working anvil backend for fraud tests

* WIP: add evm.IncreaseTime() call

* clean and reformat query

* WIP: add bumpBackends()

* WIP: merge handling of DisputeOpened on remote / summit

* Cleanup: remove logs

* Fix: build

* Cleanup: some lints; guard parses RootUpdated events

* Cleanup: more lints

* Cleanup: remove unnecessary param in VerifyStateWithSnapshot()

* Cleanup: more lints

* Cleanup: more linting

* Cleanup: remove comments

* Cleanup: merge isStateSlashable() logic

* Cleanup: unused params

* Cleanup: another unused param

* Cleanup: move event parsers to utils.go

* Cleanup: move handlers to fraud.go

* Cleanup: add comments for fraud handlers

* Cleanup: comments

* De-duplicate agent signing logic (#1228)

* WIP: merge common signing logic into sign() util

* WIP: add Encoder interface for signed types

* Feat: add consts for salt values

* Cleanup: remove specific language from generic signEncoder func

* Fix: parity tests

* Cleanup: lint

* Fix: don't parse notary err on ctx cancel

* Cleanup: enable TestGuardE2E

* Cleanup: err msg

* Fix: ignore ctx cancel err  in agents integration test

* Fix: TestAgentsE2E

* Fix: avoid int64 overflow in executor tests

* Cleanup: resolve merge conflict

* Cleanup: merge conflict

* Feat: add NowFunc for time override

* WIP: executing mngr msg

* WIP: debugging GetLatestSummitBlockNumber()

* wip: friday progress

* Feat: add PassAgentRoot to destination interface

* WIP: parse RootUpdated on light manager, submit extra attestation and bump optimistic period on destination

* WIP: manually pass in agent root in last attestation

* Feat: guard db uses GetBlockNumberForRoot()

* WIP: working test

* Feat: correct block number condition

* Cleanup: remove logs

* Cleanup: more logs

* Cleanup: more cleanup

* Cleanup: remove unnecessary event parsing, re enable guard submitter

* add GetSummitBlockNumberForRoot test

* Cleanup: logs

* Fix: re enable submitter in notary

* Cleanup: go mod tidy

* small lint

* reduce again

* support for remote scribe in guard commands

* trivial fixes

* Fix: retry contract deployment

* Extra state reports (#1287)

* Feat: submit state reports to remote chains

* Feat: add SubmitStateReportWithAttestation on LightInbox

* WIP: verify number of reports on agent domain

* Feat: add prepareStateReport() for all report submissions

* Feat: add working state report verification to TestReportFraudulentStateInAttestation

* Feat: add verifyStateReport() helper

* Feat: add verifyStateReport() helper

* WIP: add RelayableAgentStatus model

* Cleanup: remove unused dispute handling

* WIP: working TestFraudulentStateInSnapshot with new agent status model

* WIP: fix crosstable logic, logs

* Feat: add NotaryOnDestination to test setup

* WIP: working test with NotaryOnDestination and Order clause in db query

* Cleanup: logs, dead code

* Fix: db tests

* Cleanup: lints

* Cleanup: remove Debug() gorm flags

* Feat: add updateAgentStatus() test helper

* Cleanup: update db comment

* Cleanup: correct db comment

* Fix: some lints

* Cleanup: lint

* Cleanup: clear nonce

* Submitter and Retries for Fraud (#1288)

* wrap each func. need to fix test

* working tests with submitter

* remove test file

* start to sql queries for crosstable dispute handling

* retries and print statements to be deleted

* undo generic retry

* remove test files

* remove other test file

* working tests

* remove print statement in executor

* implement wasse suggestions

* [goreleaser]

* fraud report branch

* gosum

* upterm

* assert->require

* log json receipt of failed txes

* receipt

* try nightly (this is a longshot)

* shorten ci runs

* shorten ci runs

* throw reverts at deployer level in addition to solidity level

* throw reverts at deployer level in addition to solidity level

* test some ideas

* remove for

* hi

* redundant

* generation fix [ci skip]

* fatal

* summit

* real chain id

* update

* uptemr

* [ci skip]

* fix host port to not be bound to hostname

* Fix: add index to avoid 'ON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint' error

* upterm

* REVERT THIS. test changing all jaeger to null

* re enable workflow

* Revert "re enable workflow"

This reverts commit f5ca330.

* Revert "REVERT THIS. test changing all jaeger to null"

This reverts commit 2320a1c.

* start to sql queries for crosstable dispute handling

* dont run upterm

* upterm

* Fix: log tx hash within submitter

* Fix: do MIN(block_number) in db query

* error instead of warn

* Delete agents/agents/guard/test.txt

* Delete agents/agents/test.txt

* no jaeger in CI

* upterm

* Add logs

* add agent status prints

* omnirpc and increase evm increaase time by 30 secs

* fix: DDDDDDDD

* no more jaeger in ci

* Retry guard constructor

* Disable upterm

* Add check for nil guard

* Enable upterm

* Enable test without pyroscope / cov

* Bump timeouts

* Add back env vars

* Add upterm

* Log err on anvil purge

* Lint

* Add time log

* Printf

* Add address to anvil log

* Remove mem limit and enable gc

* max retry to 60 secs

* maxTotalTime on guard construcotR

* swing for the fences

* agents lint

* core lint fix

* Fix: yaml lint

* Revert "Add address to anvil log"

This reverts commit 3e401d7.

* Add codecov back to workflow

* try with run instead of command

* Use command instead of run with multiline content

* clean comments

* Fix: yaml lint

* redo go.yml

* Cleanup: gh action retries

* Cleanup: remove getTestGuard() retry

* working with some noncemanager removals

* working with all noncemanager removals

* precompile tests

* up the memlimit [no_skip] [goreleaser]

* hi [goreleaser]

* fix malformed memlimit

* reintroduce pyroscope [goreleaser]

* try to fix codecov

* github

* rename coverage.txt to profile.cov

* utilize precompilation (see: golang/go#15513)

* f

* try disabing pyroscope again

* list containers at the end [revert me] [goreleaser]

* fix the issue

* minimal log collection

* go.yml

* tmp logs

* Fix: use iota+1 for contract type

* fix: anvil test and delete debugging

* Fix: address flakes in TestUpdateAgentStatusOnRemote by bumping backends

* Cleanup: add grouped stdlib imports in editorconfig

* Cleanup: add TODO

* fix: mkdir for tmp logs for tar logs

* Cleanup: use dockerutil.GetPort()

* Cleanup: isNotSummit -> isNotary

* Cleanup: more descriptive comment on GetPort() behavior

* create parent dir for tmp logs

* fix: add iota + 1 where applicable

* Fix: bump backends after updateAgentStatus()

* use different dir for getting the logs

* revert iota + 1 in agents/contract

* undo iota + 1 in agents/types

* Add logs

* sleep pass

* Revert "Add logs"

This reverts commit 8637cb6.

* Fix: verify snapshot states before bumping evm time

* Cleanup: lint

* Config: bump retries

* Config: add on_retry_command to rm docker containers

---------

Co-authored-by: Max Planck <[email protected]>
Co-authored-by: Trajan0x <[email protected]>
Co-authored-by: Max Planck <[email protected]>
  • Loading branch information
4 people authored Sep 13, 2023
1 parent 918ff67 commit 1d50890
Show file tree
Hide file tree
Showing 118 changed files with 6,192 additions and 512 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ indent_size = 4
[*.go]
indent_size = 4
indent_style = tab
import_style = go

[*.yml]
quote_type = single
Expand Down
62 changes: 51 additions & 11 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
outputs:
# Expose matched filters as job 'packages' output variable
packages_deps: ${{ steps.filter_go_deps.outputs.changed_modules }}
packages_nodeps: ${{ steps.filter_go_nodeps.outputs.changed_modules }}
packages_nodeps: ${{ steps.filter_go_nodeps.outputs.changed_modules }}
package_count_deps: ${{ steps.length.outputs.FILTER_LENGTH_DEPS }}
package_count_nodeps: ${{ steps.length.outputs.FILTER_LENGTH_NODEPS }}
solidity_changes: ${{ steps.filter_solidity.outputs.any_changed }}
Expand Down Expand Up @@ -160,12 +160,34 @@ jobs:
PYROSCOPE_PATH: '${{ steps.pyroscope-path.outputs.PYROSCOPE_PATH }}'
APPLICATION_NAME: ${{ steps.coverage.outputs.flag }}

- name: Precompile Tests
working-directory: ${{ matrix.package }}
run: go test -run=nope ./...
env:
# no other containers are running at this point so we can use all available memory for compilation
GOMEMLIMIT: 5GiB
GOGC: -1

- name: Test
uses: nick-fields/retry@v2
with:
command: cd ${{matrix.package}} && $PYROSCOPE_PATH exec --apiKey=${{ secrets.PYROSCOPE_CLOUD_TOKEN }} -- go test -parallel 1 -coverpkg=./... ./... -coverprofile=profile.cov
max_attempts: 2
timeout_minutes: 20
command: |
set -e
cd ${{ matrix.package }}
echo "mode: atomic" > coverage.txt
for pkg in $(go list ./...); do
#$PYROSCOPE_PATH exec --apiKey=${{ secrets.PYROSCOPE_CLOUD_TOKEN }} -- go test -coverpkg="$pkg" -coverprofile=profile.cov $pkg
go test -coverpkg="$pkg" -coverprofile=profile.cov $pkg
if [ -f profile.cov ]; then
tail -n +2 profile.cov >> coverage.txt
rm profile.cov
fi
done
cp coverage.txt profile.cov
docker ps
on_retry_command: docker rm -f $(docker ps -a -q)
max_attempts: 5
timeout_minutes: 60
env:
PYROSCOPE_PATH: '${{ steps.pyroscope-path.outputs.PYROSCOPE_PATH }}'
ENABLE_MYSQL_TEST: true
Expand All @@ -180,6 +202,29 @@ jobs:
ETHEREUM_RPC_URI: ${{ secrets.ETHEREUM_RPC_URI }}
GOPROXY: https://proxy.golang.org

# TODO: these 3 steps should be moved into a reusable action.
# also,should be noted these aren't comprehensive, as many of the containers are automatically removed
# and we'd need something like this for all logs: https://github.com/synapsecns/sanguine/pull/1280#discussion_r1320889916
# but this should be better than nothing as long as you don't assume the logs are complete
#
# there's a good case to have this in addition to the suggestions referenced in the comment above because
# logs are not collected there in the case of sigterms (because logs stop piping when app breaks), which are caught here
#
# in any case this should be considered an early implementation
- name: Collect docker logs
if: always()
uses: jwalton/gh-docker-logs@v2
with:
dest: '/tmp/logs'
- name: Tar logs
if: failure()
run: tar cvzf ./logs.tgz /tmp/logs
- name: Upload logs to GitHub
if: failure()
uses: actions/upload-artifact@master
with:
name: ${{matrix.package}}-logs.tgz
path: ./logs.tgz

- name: Send Coverage (Codecov)
uses: Wandalen/[email protected]
Expand Down Expand Up @@ -278,7 +323,6 @@ jobs:
GOMEMLIMIT: 6GiB
GOGC: -1


issue_number:
# this is needed to prevent us from hitting the github api rate limit
name: Get The Issue Number
Expand All @@ -293,7 +337,6 @@ jobs:
- uses: jwalton/gh-find-current-pr@v1
id: find_pr


# check if we need to rerun go generate as a result of solidity changes. Note, this will only run on solidity changes.
# TODO: consolidate w/ go change check. This will run twice on agents
check-generation-solidity:
Expand Down Expand Up @@ -431,7 +474,6 @@ jobs:
run: yarn install --immutable
if: ${{ contains(matrix.package, 'agents') }}


# Generate flattened files
- name: Run flattener
run: npx lerna exec npm run build:go
Expand All @@ -458,7 +500,6 @@ jobs:
restore-keys: |
${{ runner.os }}-go-generate-${{matrix.package}}
- name: Cache Linuxbrew
uses: actions/cache@v3
if: ${{ contains(matrix.package, 'scribe') }}
Expand All @@ -485,18 +526,17 @@ jobs:

- name: Run Make Generate CI Deps (Scribe)
working-directory: ${{matrix.package}}/
if: ${{ contains(matrix.package, 'scribe') }}
if: ${{ contains(matrix.package, 'scribe') }}
run: |
export PATH=$PATH:$(go env GOPATH)/bin
make generate-ci || exit 0
- name: Run Make Generate CI (Scribe)
working-directory: ${{matrix.package}}/
if: ${{ contains(matrix.package, 'scribe') }}
if: ${{ contains(matrix.package, 'scribe') }}
run: |
make generate-ci
# See if we need to rerun go generate
# TODO: consider implementing https://github.com/golang/go/issues/20520 to speed up process if possible
- name: Try Go Generate
Expand Down
9 changes: 6 additions & 3 deletions agents/agents/agentsintegration/agentsintegration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"testing"
"time"

"github.com/Flaque/filet"
awsTime "github.com/aws/smithy-go/time"
"github.com/brianvoe/gofakeit/v6"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
Expand All @@ -25,6 +24,8 @@ import (
"github.com/synapsecns/sanguine/services/scribe/client"
scribeConfig "github.com/synapsecns/sanguine/services/scribe/config"
"github.com/synapsecns/sanguine/services/scribe/service"

"github.com/Flaque/filet"
)

func RemoveAgentsTempFile(t *testing.T, fileName string) {
Expand Down Expand Up @@ -211,7 +212,7 @@ func (u *AgentsIntegrationSuite) TestAgentsE2E() {

Equal(u.T(), encodedNotaryTestConfig, decodedAgentConfigBackToEncodedBytes)

guard, err := guard.NewGuard(u.GetTestContext(), guardTestConfig, omniRPCClient, u.GuardTestDB, u.GuardMetrics)
guard, err := guard.NewGuard(u.GetTestContext(), guardTestConfig, omniRPCClient, scribeClient.ScribeClient, u.GuardTestDB, u.GuardMetrics)
Nil(u.T(), err)

tips := types.NewTips(big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0))
Expand Down Expand Up @@ -251,7 +252,9 @@ func (u *AgentsIntegrationSuite) TestAgentsE2E() {
go func() {
// we don't check errors here since this will error on cancellation at the end of the test
err = guard.Start(u.GetTestContext())
u.Nil(err)
if !testDone {
u.Nil(err)
}
}()

u.Eventually(func() bool {
Expand Down
4 changes: 2 additions & 2 deletions agents/agents/exampleagent/exampleagent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ func (u ExampleAgentSuite) TestExampleAgentSimulatedTestSuite() {
Nil(u.T(), err)
Equal(u.T(), uint32(u.TestBackendDestination.GetChainID()), notaryStatus.Domain)

notaryStatusFromEVM, err := u.SummitDomainClient.BondingManager().GetAgentStatus(u.GetTestContext(), u.NotaryBondedSigner)
notaryStatusFromEVM, err := u.SummitDomainClient.BondingManager().GetAgentStatus(u.GetTestContext(), u.NotaryBondedSigner.Address())
Nil(u.T(), err)
Equal(u.T(), notaryStatusFromEVM.Domain(), uint32(u.TestBackendDestination.GetChainID()))

guardStatus, err := u.SummitContract.AgentStatus(&bind.CallOpts{Context: u.GetTestContext()}, u.GuardBondedSigner.Address())
Nil(u.T(), err)
Equal(u.T(), uint32(0), guardStatus.Domain)

guardStatusFromEVM, err := u.SummitDomainClient.BondingManager().GetAgentStatus(u.GetTestContext(), u.GuardBondedSigner)
guardStatusFromEVM, err := u.SummitDomainClient.BondingManager().GetAgentStatus(u.GetTestContext(), u.GuardBondedSigner.Address())
Nil(u.T(), err)
Equal(u.T(), guardStatusFromEVM.Domain(), uint32(0))
}
6 changes: 3 additions & 3 deletions agents/agents/executor/cmd/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ var ExecutorRunCommand = &cli.Command{
case "embedded":
eventDB, err := scribeAPI.InitDB(
ctx,
executorConfig.ScribeConfig.EmbeddedDBConfig.Type,
executorConfig.ScribeConfig.EmbeddedDBConfig.Source,
executorConfig.DBConfig.Type,
executorConfig.DBConfig.Source,
handler,
false,
)
Expand Down Expand Up @@ -157,7 +157,7 @@ var ExecutorRunCommand = &cli.Command{

embedded := client.NewEmbeddedScribe(
executorConfig.ScribeConfig.EmbeddedDBConfig.Type,
executorConfig.ScribeConfig.EmbeddedDBConfig.Source,
executorConfig.DBConfig.Source,
handler,
)

Expand Down
24 changes: 17 additions & 7 deletions agents/agents/executor/db/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,25 @@ package db_test
import (
"database/sql"
"fmt"
"os"
"sync"
"sync/atomic"
"testing"
"time"

"github.com/Flaque/filet"
. "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"github.com/synapsecns/sanguine/agents/agents/executor/db"
"github.com/synapsecns/sanguine/agents/agents/executor/db/sql/mysql"
"github.com/synapsecns/sanguine/agents/agents/executor/db/sql/sqlite"
"github.com/synapsecns/sanguine/agents/agents/executor/metadata"
"github.com/synapsecns/sanguine/core"
"github.com/synapsecns/sanguine/core/dbcommon"
"github.com/synapsecns/sanguine/core/metrics"
"github.com/synapsecns/sanguine/core/metrics/localmetrics"
"github.com/synapsecns/sanguine/core/testsuite"
"gorm.io/gorm/schema"
"os"
"sync"
"sync/atomic"
"testing"
"time"
)

type DBSuite struct {
Expand All @@ -41,10 +43,18 @@ func NewEventDBSuite(tb testing.TB) *DBSuite {
func (t *DBSuite) SetupSuite() {
t.TestSuite.SetupSuite()

localmetrics.SetupTestJaeger(t.GetSuiteContext(), t.T())
// don't use metrics on ci for integration tests
isCI := core.GetEnvBool("CI", false)
useMetrics := !isCI
metricsHandler := metrics.Null

if useMetrics {
localmetrics.SetupTestJaeger(t.GetSuiteContext(), t.T())
metricsHandler = metrics.Jaeger
}

var err error
t.metrics, err = metrics.NewByType(t.GetSuiteContext(), metadata.BuildInfo(), metrics.Jaeger)
t.metrics, err = metrics.NewByType(t.GetSuiteContext(), metadata.BuildInfo(), metricsHandler)
Nil(t.T(), err)
}

Expand Down
16 changes: 12 additions & 4 deletions agents/agents/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ type chainExecutor struct {
rpcClient Backend
// boundDestination is a bound destination contract.
boundDestination domains.DestinationContract
// boundOrigin is a bound origin contract.
boundOrigin domains.OriginContract
}

// Executor is the executor agent.
Expand All @@ -73,8 +75,6 @@ type Executor struct {
config executor.Config
// executorDB is the executor agent database.
executorDB db.ExecutorDB
// scribeClient is the client to the Scribe gRPC server.
scribeClient client.ScribeClient
// grpcClient is the gRPC client.
grpcClient pbscribe.ScribeServiceClient
// grpcConn is the gRPC connection.
Expand All @@ -87,6 +87,8 @@ type Executor struct {
handler metrics.Handler
// txSubmitter is the transaction submitter.
txSubmitter submitter.TransactionSubmitter
// NowFunc returns the current time.
NowFunc func() time.Time
}

// logOrderInfo is a struct to keep track of the order of a log.
Expand Down Expand Up @@ -198,6 +200,11 @@ func NewExecutor(ctx context.Context, config executor.Config, executorDB db.Exec
return nil, fmt.Errorf("could not bind destination contract: %w", err)
}

boundOrigin, err := evm.NewOriginContract(ctx, chainClient, common.HexToAddress(chain.OriginAddress))
if err != nil {
return nil, fmt.Errorf("could not bind origin contract: %w", err)
}

tree, err := newTreeFromDB(ctx, chain.ChainID, executorDB)
if err != nil {
return nil, fmt.Errorf("could not get tree from db: %w", err)
Expand All @@ -219,19 +226,20 @@ func NewExecutor(ctx context.Context, config executor.Config, executorDB db.Exec
merkleTree: tree,
rpcClient: evmClient,
boundDestination: boundDestination,
boundOrigin: boundOrigin,
}
}

return &Executor{
config: config,
executorDB: executorDB,
scribeClient: scribeClient,
grpcConn: conn,
grpcClient: grpcClient,
signer: executorSigner,
chainExecutors: chainExecutors,
handler: handler,
txSubmitter: txSubmitter,
NowFunc: time.Now,
}, nil
}

Expand Down Expand Up @@ -784,7 +792,7 @@ func (e Executor) executeExecutable(parentCtx context.Context, chainID uint32) (
backoffInterval = time.Duration(e.config.ExecuteInterval) * time.Second

page := 1
currentTime := uint64(time.Now().Unix())
currentTime := uint64(e.NowFunc().Unix())

messageMask := db.DBMessage{
ChainID: &chainID,
Expand Down
16 changes: 7 additions & 9 deletions agents/agents/executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ func (e *ExecutorSuite) TestExecutor() {
gasData := types.NewGasData(uint16(1), uint16(1), uint16(1), uint16(1), uint16(1), uint16(1))
originState := types.NewState(rootB32, chainID, nonce, big.NewInt(1), big.NewInt(1), gasData)
randomGasData := types.NewGasData(gofakeit.Uint16(), gofakeit.Uint16(), gofakeit.Uint16(), gofakeit.Uint16(), gofakeit.Uint16(), gofakeit.Uint16())
randomState := types.NewState(common.BigToHash(big.NewInt(gofakeit.Int64())), chainID+1, gofakeit.Uint32(), big.NewInt(gofakeit.Int64()), big.NewInt(gofakeit.Int64()), randomGasData)
randomState := types.NewState(common.BigToHash(big.NewInt(int64(gofakeit.Int32()))), chainID+1, gofakeit.Uint32(), big.NewInt(int64(gofakeit.Int32())), big.NewInt(int64(gofakeit.Int32())), randomGasData)
originSnapshot := types.NewSnapshot([]types.State{originState, randomState})

snapshotRoot, proofs, err := originSnapshot.SnapshotRootAndProofs()
Expand Down Expand Up @@ -682,22 +682,22 @@ func (e *ExecutorSuite) TestSetMinimumTime() {
common.BigToHash(big.NewInt(gofakeit.Int64())),
chainID,
1,
big.NewInt(gofakeit.Int64()),
big.NewInt(gofakeit.Int64()),
big.NewInt(int64(gofakeit.Int32())),
big.NewInt(int64(gofakeit.Int32())),
types.NewGasData(gofakeit.Uint16(), gofakeit.Uint16(), gofakeit.Uint16(), gofakeit.Uint16(), gofakeit.Uint16(), gofakeit.Uint16()))
state1 := types.NewState(
common.BigToHash(big.NewInt(gofakeit.Int64())),
chainID,
2,
big.NewInt(gofakeit.Int64()),
big.NewInt(gofakeit.Int64()),
big.NewInt(int64(gofakeit.Int32())),
big.NewInt(int64(gofakeit.Int32())),
types.NewGasData(gofakeit.Uint16(), gofakeit.Uint16(), gofakeit.Uint16(), gofakeit.Uint16(), gofakeit.Uint16(), gofakeit.Uint16()))
state2 := types.NewState(
common.BigToHash(big.NewInt(gofakeit.Int64())),
chainID,
5,
big.NewInt(gofakeit.Int64()),
big.NewInt(gofakeit.Int64()),
big.NewInt(int64(gofakeit.Int32())),
big.NewInt(int64(gofakeit.Int32())),
types.NewGasData(gofakeit.Uint16(), gofakeit.Uint16(), gofakeit.Uint16(), gofakeit.Uint16(), gofakeit.Uint16(), gofakeit.Uint16()))

snapshot0 := types.NewSnapshot([]types.State{state0})
Expand Down Expand Up @@ -992,7 +992,6 @@ func (e *ExecutorSuite) TestSendManagerMessage() {
txContext := e.TestBackendSummit.GetTxContext(e.GetTestContext(), e.SummitMetadata.OwnerPtr())
tx, err = e.SummitDomainClient.Inbox().SubmitSnapshot(
txContext.TransactOpts,
e.GuardUnbondedSigner,
encodedSnapshot,
guardSnapshotSignature,
)
Expand All @@ -1005,7 +1004,6 @@ func (e *ExecutorSuite) TestSendManagerMessage() {
e.Nil(err)
tx, err = e.SummitDomainClient.Inbox().SubmitSnapshot(
txContext.TransactOpts,
e.NotaryUnbondedSigner,
encodedSnapshot,
notarySnapshotSignature,
)
Expand Down
Loading

0 comments on commit 1d50890

Please sign in to comment.