Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fraud reporting #1280

Merged
merged 259 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
259 commits
Select commit Hold shift + click to select a range
1da17bc
[goreleaser]
CryptoMaxPlanck Jul 7, 2023
943e3a9
up to calling submitStateReport
CryptoMaxPlanck Jul 10, 2023
6008d94
barebones report invalid state in snapshot. need to update root PR
CryptoMaxPlanck Jul 10, 2023
824b6dd
make contract interfaces return txs for submitter
CryptoMaxPlanck Jul 11, 2023
c87f577
[goreleaser]
CryptoMaxPlanck Jul 11, 2023
f10dbcc
merged in root branch
CryptoMaxPlanck Jul 11, 2023
84f9360
Cleanup: setup in parallel
dwasse Jul 11, 2023
94f4eef
staging: working on fraud_test notary signature
CryptoMaxPlanck Jul 12, 2023
fd356b4
WIP: working thru fraud test
dwasse Jul 12, 2023
abf6fa8
WIP: working test
dwasse Jul 12, 2023
7f05148
Cleanup: remove logs
dwasse Jul 12, 2023
efd9717
Cleanup: more logs
dwasse Jul 12, 2023
c6619fb
Fix: throw error for int64 overflow in EncodeState()
dwasse Jul 12, 2023
05b0624
WIP: fraud attestation handling
dwasse Jul 13, 2023
ce185cb
WIP: add TestReportAttestationNotOnSummit
dwasse Jul 13, 2023
fd5fa91
WIP: testing. not getting log for submitAttestation event
CryptoMaxPlanck Jul 13, 2023
332fcab
WIP, getting error of datahash code 0x184fb2df0de4da8049867b20a0d8b82…
CryptoMaxPlanck Jul 14, 2023
dfebf72
WIP: successfully submitting fraudulent attestation. now debugging gu…
CryptoMaxPlanck Jul 14, 2023
19ae034
WIP: working TestReportAttestationNotOnSummit
dwasse Jul 14, 2023
46b5240
Cleanup: test, remove logs
dwasse Jul 14, 2023
0da2c87
Cleanup: remove GetAttestationComputeHash(), instead calculate hash a…
dwasse Jul 14, 2023
91fc98f
Cleanup: remove unnecessary TestEncodeChainGasParity for now
dwasse Jul 14, 2023
7393dc6
Cleanup: remove init() used for debugging lightinbox.metadata.go
dwasse Jul 14, 2023
c566592
Cleanup: de-functionalize slashAccusedAgent() for consistency
dwasse Jul 14, 2023
c9aef39
WIP: adding submitAttestationReport
CryptoMaxPlanck Jul 20, 2023
c95a3c8
working submitattestationreport
CryptoMaxPlanck Jul 20, 2023
5c21cc1
WIP: getting a signature for the STATE report
CryptoMaxPlanck Jul 20, 2023
75b25e6
small changes before handoff
CryptoMaxPlanck Jul 24, 2023
29b76cc
WIP: verifyStateWithAttestation case impl
dwasse Jul 24, 2023
b5d269a
Feat: add TestReportFraudulentStateInAttestation
dwasse Jul 24, 2023
62257fd
staging. added a getter to the bondingmanager
CryptoMaxPlanck Jul 24, 2023
b321d83
working test for fraudulentstateinattestation
CryptoMaxPlanck Jul 24, 2023
73c093e
WIP: add receipt type with encoder
dwasse Jul 24, 2023
fa43c35
WIP: add TestInvalidReceipt and handleReceipt impl
dwasse Jul 24, 2023
21c5426
CLEANME: added checks to test and start with tips encoding parity
CryptoMaxPlanck Jul 25, 2023
45dc4cf
WIP: working case 1 of agnetStatusUpdate
CryptoMaxPlanck Jul 25, 2023
45a434d
WIP: opendispute handling
CryptoMaxPlanck Jul 25, 2023
48ef1d8
Cleanup: guard impl
dwasse Jul 25, 2023
23d73e9
Cleanup: remove checks from event parser methods
dwasse Jul 26, 2023
49bf63a
start of db implementation
CryptoMaxPlanck Jul 26, 2023
eb8942e
fix
trajan0x Jul 26, 2023
9d9a7db
fillbytes
trajan0x Jul 26, 2023
fdf5479
fix
trajan0x Jul 26, 2023
b802b78
staging
CryptoMaxPlanck Jul 26, 2023
108c698
Merge branch 'feat/testing_fraud_reporting' of github.com:synapsecns/…
dwasse Jul 26, 2023
0f6060c
Cleanup: remove printing reverts
dwasse Jul 26, 2023
2641d28
WIP: add getTestGuard() helper
dwasse Jul 27, 2023
9ee8292
working receipt fraud test
CryptoMaxPlanck Jul 27, 2023
2de5097
Cleanup: add bumpTx helper
dwasse Jul 27, 2023
fab96e8
Cleanup: utilize AgentFlagType enum for AgentStatus.Flag values
dwasse Jul 27, 2023
f958ba7
Cleanup: use getTestGuard() helper in all tests
dwasse Jul 27, 2023
828fc73
Cleanup: remove unnecessary test code
dwasse Jul 27, 2023
264b4af
Feat: add DisputeStatus type, GetDisputeStatus() call to BondingManager
dwasse Jul 27, 2023
6bc690e
Feat: guard checks dispute status before submitting state report
dwasse Jul 27, 2023
e5e4f5b
Cleanup: remove embedded lightinbox
dwasse Jul 27, 2023
c8b2eba
Cleanup: Domain -> AgentDomain
dwasse Jul 27, 2023
8eb9bee
WIP: verify agent status before slashing
dwasse Jul 27, 2023
f57e466
working multiple state case
CryptoMaxPlanck Jul 27, 2023
0d3f04b
Merge branch 'feat/testing_fraud_reporting' into feat/database_for_fr…
CryptoMaxPlanck Jul 27, 2023
35a1eb1
start to sql queries for crosstable dispute handling
CryptoMaxPlanck Jul 28, 2023
ff8d7bd
WIP: implement db queries and logic for updateAgentStatus() call
dwasse Jul 28, 2023
984ce75
WIP: fix cyclic deps
dwasse Jul 28, 2023
30a9920
Fix: build errs
dwasse Jul 28, 2023
bdb43d3
Add db tests
dwasse Jul 28, 2023
7efee30
wip: crosstable
CryptoMaxPlanck Jul 28, 2023
c31de0b
passing TestGetUpdateAgentStatusParameters
CryptoMaxPlanck Jul 28, 2023
f8c3988
working crosstable testrs
CryptoMaxPlanck Jul 29, 2023
90e89a1
WIP: add updateAgentStatuses()
dwasse Jul 30, 2023
1b1b3ed
Feat: working anvil backend for fraud tests
dwasse Jul 30, 2023
3bfd0b2
WIP: add evm.IncreaseTime() call
dwasse Jul 30, 2023
9d302b7
clean and reformat query
CryptoMaxPlanck Jul 31, 2023
88b67d1
WIP: add bumpBackends()
dwasse Jul 31, 2023
2b7cd80
Merge branch 'feat/database_for_fraud_guard' of github.com:synapsecns…
dwasse Jul 31, 2023
ba8c26c
WIP: merge handling of DisputeOpened on remote / summit
dwasse Jul 31, 2023
5c15971
Cleanup: remove logs
dwasse Jul 31, 2023
6e4aa2a
Fix: build
dwasse Jul 31, 2023
9af0954
Cleanup: some lints; guard parses RootUpdated events
dwasse Jul 31, 2023
f7e13a6
Cleanup: more lints
dwasse Jul 31, 2023
f43602d
Cleanup: remove unnecessary param in VerifyStateWithSnapshot()
dwasse Jul 31, 2023
235f768
Cleanup: more lints
dwasse Jul 31, 2023
e686cd3
Cleanup: more linting
dwasse Jul 31, 2023
afd2e80
Cleanup: remove comments
dwasse Aug 1, 2023
aecd616
Cleanup: merge isStateSlashable() logic
dwasse Aug 1, 2023
73f38f4
Cleanup: unused params
dwasse Aug 1, 2023
d797534
Cleanup: another unused param
dwasse Aug 1, 2023
2810730
Cleanup: move event parsers to utils.go
dwasse Aug 1, 2023
01658b3
Cleanup: move handlers to fraud.go
dwasse Aug 1, 2023
d31c28d
Cleanup: add comments for fraud handlers
dwasse Aug 1, 2023
ce11472
Cleanup: comments
dwasse Aug 2, 2023
c38b94c
De-duplicate agent signing logic (#1228)
dwasse Aug 3, 2023
19b7d96
Fix: don't parse notary err on ctx cancel
dwasse Aug 9, 2023
9fe4808
Cleanup: enable TestGuardE2E
dwasse Aug 9, 2023
09e1358
Cleanup: err msg
dwasse Aug 9, 2023
b7920da
Fix: ignore ctx cancel err in agents integration test
dwasse Aug 9, 2023
2e28198
Fix: TestAgentsE2E
dwasse Aug 9, 2023
c7c75b0
Fix: avoid int64 overflow in executor tests
dwasse Aug 9, 2023
71cc2d3
Cleanup: resolve merge conflict
dwasse Aug 9, 2023
ddfccc4
Cleanup: merge conflict
dwasse Aug 9, 2023
e19e24b
Merge branch 'master' into feat/testing_fraud_reporting_merge-2
dwasse Aug 24, 2023
25a2339
Feat: add NowFunc for time override
dwasse Aug 17, 2023
fd84c27
WIP: executing mngr msg
dwasse Aug 17, 2023
6b06490
WIP: debugging GetLatestSummitBlockNumber()
dwasse Aug 17, 2023
519c8b6
wip: friday progress
CryptoMaxPlanck Aug 21, 2023
a538d34
Feat: add PassAgentRoot to destination interface
dwasse Aug 21, 2023
9cd516d
WIP: parse RootUpdated on light manager, submit extra attestation and…
dwasse Aug 22, 2023
9cf836f
WIP: manually pass in agent root in last attestation
dwasse Aug 22, 2023
ac42dd0
Feat: guard db uses GetBlockNumberForRoot()
dwasse Aug 23, 2023
bcdee95
WIP: working test
dwasse Aug 23, 2023
c23ba3d
Feat: correct block number condition
dwasse Aug 23, 2023
f63d2ad
Cleanup: remove logs
dwasse Aug 23, 2023
360a927
Cleanup: more logs
dwasse Aug 23, 2023
f8ab04f
Cleanup: more cleanup
dwasse Aug 23, 2023
00fd2ae
Cleanup: remove unnecessary event parsing, re enable guard submitter
dwasse Aug 23, 2023
94a8a38
add GetSummitBlockNumberForRoot test
CryptoMaxPlanck Aug 23, 2023
0e105f2
Cleanup: logs
dwasse Aug 23, 2023
a9423d3
Fix: re enable submitter in notary
dwasse Aug 23, 2023
5b67a57
Cleanup: go mod tidy
dwasse Aug 24, 2023
2829084
small lint
CryptoMaxPlanck Aug 24, 2023
a061a36
Merge branch 'master' into feat/fraud-reports
trajan0x Aug 24, 2023
3900a3c
reduce again
trajan0x Aug 24, 2023
0a92393
Merge branch 'flake-reduction' into feat/fraud-reports
trajan0x Aug 24, 2023
a0e7803
support for remote scribe in guard commands
CryptoMaxPlanck Aug 24, 2023
147e995
trivial fixes
CryptoMaxPlanck Aug 24, 2023
ce22b61
Fix: retry contract deployment
dwasse Aug 24, 2023
6ad19c1
Extra state reports (#1287)
dwasse Aug 30, 2023
7322033
Submitter and Retries for Fraud (#1288)
CryptoMaxPlanck Aug 31, 2023
8feb18e
[goreleaser]
CryptoMaxPlanck Aug 31, 2023
1190f19
merge master
trajan0x Sep 3, 2023
219a92b
fraud report branch
trajan0x Sep 3, 2023
ec22f10
gosum
trajan0x Sep 3, 2023
805679e
upterm
trajan0x Sep 3, 2023
1a98f54
assert->require
trajan0x Sep 3, 2023
01d1756
log json receipt of failed txes
trajan0x Sep 3, 2023
f435728
receipt
trajan0x Sep 3, 2023
27c2865
try nightly (this is a longshot)
trajan0x Sep 3, 2023
409e46c
shorten ci runs
trajan0x Sep 3, 2023
aee75c8
shorten ci runs
trajan0x Sep 3, 2023
3f354d8
throw reverts at deployer level in addition to solidity level
trajan0x Sep 3, 2023
f2d2280
throw reverts at deployer level in addition to solidity level
trajan0x Sep 3, 2023
1892d4f
test some ideas
trajan0x Sep 3, 2023
45159b6
remove for
trajan0x Sep 3, 2023
11a02ac
hi
trajan0x Sep 3, 2023
a93116a
redundant
trajan0x Sep 4, 2023
c1e065d
generation fix [ci skip]
trajan0x Sep 4, 2023
ead8913
fatal
trajan0x Sep 4, 2023
6c729e9
summit
trajan0x Sep 4, 2023
4b85114
real chain id
trajan0x Sep 4, 2023
31ab06f
update
trajan0x Sep 4, 2023
3cd7866
uptemr
trajan0x Sep 4, 2023
f92aea9
[ci skip]
trajan0x Sep 4, 2023
458ec8e
fix host port to not be bound to hostname
trajan0x Sep 4, 2023
d9f4169
Fix: add index to avoid 'ON CONFLICT clause does not match any PRIMAR…
dwasse Sep 4, 2023
99acad0
upterm
CryptoMaxPlanck Sep 5, 2023
2320a1c
REVERT THIS. test changing all jaeger to null
CryptoMaxPlanck Sep 5, 2023
f5ca330
re enable workflow
CryptoMaxPlanck Sep 5, 2023
8faecec
Merge branch 'master' into feat/fraud-reports
dwasse Sep 5, 2023
30eb6e6
Revert "re enable workflow"
CryptoMaxPlanck Sep 5, 2023
605ef48
Revert "REVERT THIS. test changing all jaeger to null"
CryptoMaxPlanck Sep 5, 2023
d93c81c
start to sql queries for crosstable dispute handling
CryptoMaxPlanck Sep 5, 2023
ecfdaea
dont run upterm
CryptoMaxPlanck Sep 5, 2023
cb719a5
upterm
CryptoMaxPlanck Sep 5, 2023
c606fcf
Fix: log tx hash within submitter
dwasse Sep 5, 2023
f799478
Fix: do MIN(block_number) in db query
dwasse Sep 5, 2023
62ec6ce
error instead of warn
CryptoMaxPlanck Sep 5, 2023
f65738b
Delete agents/agents/guard/test.txt
CryptoMaxPlanck Sep 6, 2023
7703490
Delete agents/agents/test.txt
CryptoMaxPlanck Sep 6, 2023
8707d3e
no jaeger in CI
CryptoMaxPlanck Sep 6, 2023
36d1b85
Merge branch 'feat/fraud-reports' of https://github.com/synapsecns/sa…
CryptoMaxPlanck Sep 6, 2023
1feee11
upterm
CryptoMaxPlanck Sep 6, 2023
5d5b84f
Add logs
dwasse Sep 6, 2023
61b0b6a
add agent status prints
CryptoMaxPlanck Sep 6, 2023
60b7222
omnirpc and increase evm increaase time by 30 secs
CryptoMaxPlanck Sep 6, 2023
55eefde
fix: DDDDDDDD
CryptoMaxPlanck Sep 6, 2023
a8cbe00
no more jaeger in ci
CryptoMaxPlanck Sep 6, 2023
61853b9
Retry guard constructor
dwasse Sep 6, 2023
4d70d91
Disable upterm
dwasse Sep 6, 2023
36b4568
Add check for nil guard
dwasse Sep 6, 2023
e74a9aa
Merge branch 'master' into feat/fraud-reports
CryptoMaxPlanck Sep 7, 2023
15c0e2b
Enable upterm
dwasse Sep 7, 2023
ea21202
Enable test without pyroscope / cov
dwasse Sep 7, 2023
9bd2904
Bump timeouts
dwasse Sep 7, 2023
7cb09cf
Add back env vars
dwasse Sep 7, 2023
ac3d016
Add upterm
dwasse Sep 7, 2023
e97679f
Log err on anvil purge
dwasse Sep 7, 2023
576a0b9
Lint
dwasse Sep 7, 2023
6f93184
Add time log
dwasse Sep 7, 2023
f964dea
Printf
dwasse Sep 7, 2023
3e401d7
Add address to anvil log
dwasse Sep 7, 2023
ee40b9a
Remove mem limit and enable gc
dwasse Sep 7, 2023
10fb7e4
max retry to 60 secs
CryptoMaxPlanck Sep 7, 2023
86bd3b3
maxTotalTime on guard construcotR
CryptoMaxPlanck Sep 7, 2023
a5d698e
swing for the fences
CryptoMaxPlanck Sep 8, 2023
029f583
agents lint
CryptoMaxPlanck Sep 7, 2023
9312c1e
core lint fix
CryptoMaxPlanck Sep 7, 2023
33a92ce
Fix: yaml lint
dwasse Sep 8, 2023
7ee4d9a
Revert "Add address to anvil log"
dwasse Sep 8, 2023
3feadde
Add codecov back to workflow
dwasse Sep 8, 2023
95eb6ad
try with run instead of command
CryptoMaxPlanck Sep 8, 2023
4e709b2
Use command instead of run with multiline content
dwasse Sep 8, 2023
1dbc6a4
clean comments
CryptoMaxPlanck Sep 8, 2023
20620fa
Fix: yaml lint
dwasse Sep 8, 2023
424746c
redo go.yml
CryptoMaxPlanck Sep 8, 2023
fb48ce6
Merge branch 'feat/fraud-reports' of https://github.com/synapsecns/sa…
CryptoMaxPlanck Sep 8, 2023
9fc2a1c
Cleanup: gh action retries
dwasse Sep 8, 2023
b13f8c9
Cleanup: remove getTestGuard() retry
dwasse Sep 8, 2023
7f8938a
working with some noncemanager removals
CryptoMaxPlanck Sep 8, 2023
6031092
working with all noncemanager removals
CryptoMaxPlanck Sep 8, 2023
e3c8bce
precompile tests
trajan0x Sep 9, 2023
503ea1c
up the memlimit [no_skip] [goreleaser]
trajan0x Sep 9, 2023
9f81b0f
hi [goreleaser]
trajan0x Sep 9, 2023
eabb67d
fix malformed memlimit
trajan0x Sep 9, 2023
01afb2e
reintroduce pyroscope [goreleaser]
trajan0x Sep 9, 2023
a2c5e32
try to fix codecov
trajan0x Sep 10, 2023
24d8976
github
trajan0x Sep 10, 2023
5d4c122
rename coverage.txt to profile.cov
trajan0x Sep 10, 2023
eadf20f
utilize precompilation (see: https://github.com/golang/go/issues/15513)
trajan0x Sep 10, 2023
0c88d79
f
trajan0x Sep 10, 2023
913228c
try disabing pyroscope again
trajan0x Sep 10, 2023
1cb0814
list containers at the end [revert me] [goreleaser]
trajan0x Sep 10, 2023
6ae6ae1
fix the issue
trajan0x Sep 11, 2023
eb93a52
minimal log collection
trajan0x Sep 11, 2023
405ed95
go.yml
trajan0x Sep 11, 2023
75621f6
tmp logs
trajan0x Sep 11, 2023
927b127
Fix: use iota+1 for contract type
dwasse Sep 11, 2023
c652de6
fix: anvil test and delete debugging
CryptoMaxPlanck Sep 11, 2023
f5eb4de
Merge branch 'feat/fraud-reports' of https://github.com/synapsecns/sa…
CryptoMaxPlanck Sep 11, 2023
6eacbcf
Fix: address flakes in TestUpdateAgentStatusOnRemote by bumping backends
dwasse Sep 12, 2023
ef8bd3b
Merge branch 'feat/fraud-reports' of github.com:synapsecns/sanguine i…
dwasse Sep 12, 2023
dba250c
Merge branch 'feat/fast-fraud-reports' into feat/fraud-reports
dwasse Sep 12, 2023
dc3470e
Cleanup: add grouped stdlib imports in editorconfig
dwasse Sep 12, 2023
241b3ee
Cleanup: add TODO
dwasse Sep 12, 2023
510adc4
fix: mkdir for tmp logs for tar logs
CryptoMaxPlanck Sep 12, 2023
3a1dcb8
Cleanup: use dockerutil.GetPort()
dwasse Sep 12, 2023
0842b4f
Merge branch 'feat/fraud-reports' of github.com:synapsecns/sanguine i…
dwasse Sep 12, 2023
0efe05a
Cleanup: isNotSummit -> isNotary
dwasse Sep 12, 2023
bbd958f
Cleanup: more descriptive comment on GetPort() behavior
dwasse Sep 12, 2023
de1647c
create parent dir for tmp logs
CryptoMaxPlanck Sep 12, 2023
1b76862
fix: add iota + 1 where applicable
CryptoMaxPlanck Sep 12, 2023
771e1c4
Fix: bump backends after updateAgentStatus()
dwasse Sep 12, 2023
1f03f51
use different dir for getting the logs
CryptoMaxPlanck Sep 12, 2023
4cacd90
Merge branch 'feat/fraud-reports' of https://github.com/synapsecns/sa…
CryptoMaxPlanck Sep 12, 2023
178f7dd
revert iota + 1 in agents/contract
CryptoMaxPlanck Sep 12, 2023
1e6acb6
undo iota + 1 in agents/types
CryptoMaxPlanck Sep 12, 2023
8637cb6
Add logs
dwasse Sep 12, 2023
603dafc
sleep pass
CryptoMaxPlanck Sep 13, 2023
9cb2f2e
Revert "Add logs"
dwasse Sep 13, 2023
235d50e
Fix: verify snapshot states before bumping evm time
dwasse Sep 13, 2023
dcbb806
Cleanup: lint
dwasse Sep 13, 2023
c823471
Config: bump retries
dwasse Sep 13, 2023
0c2f2cc
Config: add on_retry_command to rm docker containers
dwasse Sep 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/wretry.action@v1.0.36
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 @@
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 @@
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 @@
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 @@
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)
}

Check warning on line 206 in agents/agents/executor/executor.go

View check run for this annotation

Codecov / codecov/patch

agents/agents/executor/executor.go#L205-L206

Added lines #L205 - L206 were not covered by tests

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 @@
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 @@
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
Loading