node: Fix issue where transfers that were loaded from the DB did not add
a flow-cancel transfer on the TargetChain
Flow-canceling is done in the `ProcessMsgForTime` loop when a new
message occurs. However, this was not done when a node restarted and
reloaded transfers from the past 24 hours. As a result it was possible
for the node to calculate a result that showed that the outgoing
transfers for an emitter chain exceeded the daily limit. In effect this
is true but only with the condition that there was incoming flow to
allow this to happen. This appeared to violate an invariant and so the
node did not start properly.
Add unit tests when reloading flow cancel transactions from the
database
* node: add more unit tests for flow cancel
* node: Fix tokenEntry indexing issue in Governor flow cancel logic
- Indexes the tokenEntry for flow cancel tokens properly (using the
token's origin chain and origin address
- Add many more tests to check flow cancel logic in more detail and at
the resolution of the ProcessMsgForTime method.
Big thanks to Max for helping to debug the issue and the unit tests.
* node: add check to ensure the governor usage is not zero
* node: Change flow cancel test so that origin and emitter chain are different
* node: Add unit test for partial flow cancel
Add additional test for flow cancel mechanism where the numbers do not
cleanly cancel out.
* node: fix lint issues in governor test
* Update ChainGovernorResetReleaseTimerRequest protobuf message
* Add numDays argument to governor-reset-release-timer command
* Update governor backend to support numDays argument
* Address review comments
* Add test for resetReleaseTimerForTime()'s numDays parameter
* Address review comments
* Add adminrpc test for ChainGovernorResetReleaseTimer
* Replace hardcoded upper boundaries with maxResetReleaseTimerDays
* Update governor whitepaper to reflect the new argument
* Added default value to governor whitepaper
---------
Co-authored-by: Jason Matthyser <jason@asymmetric.re>
Flow Cancel
A 'flow cancel' transfer occurs when all of the following are true:
An emitter chain is governed by the Governor
A transfer has a TargetChain equal to the emitter
A transfer's Timestamp is within the usual 24 hour window used by the Governor
The asset in the transfer has fields OriginChain and OriginAddress equal to an entry in the allow list
Example scenario
A particular USDC implementation minted on Ethereum. It is allow-listed.
A transfer of $1,000 of this asset is sent from Solana to Sui.
Before the transfer, Sui's usage is $10,000.
Before the transfer, Solana's usage is $0.
After the transfer is processed, Sui's new usage will be $9,000 (flow cancel) and Solana's new usage will be $1,000 (as usual).
* node: add manual token list for Mantle
* node: add additional mantle tokens
* node: remove incorrect manual token for mantle
* node: Fix mantle token links
Source all token addresses from https://explorer.mantle.xyz/,
cross-referenced with CoinGecko's results for top Mantle tokens by daily
volume
* node: add x layer tokens to manual_tokens.go
- Coin Gecko IDs left blank here because there is no entry for these
tokens yet
- Prices are taken from the chain explorer directly
* node: Update X Layer manual token list
- Fix Chain ID
- Add more tokens with >50k daily volume
- Add CG IDs for tokens that have them
- Add commented out tokens that have high volume but no CH entries
- Update prices (use CG price where available)
* node: remove tokens without CoinGecko IDs
* node: update quic-go
Ran via:
go get github.com/quic-go/quic-go@v0.42.0
* node: update mongo-drive dependency
Ran via:
go get go.mongodb.org/mongo-driver@latest
* node: upgrade libp2p-go
Ran via:
go get github.com/libp2p/go-libp2p@v0.33.1
Refs: #3863
* node: fallout from the go upgrade in the go.sum
Run via:
go mod tidy
This updates the go.sum and removes unnecessary indirect references.
* docs: use go1.21.8
* github: use go1.21.8
Except for wormchain.
* node: update dockerfiles to use go 1.21.8
This was done with scripts/update-go-version.sh
* scripts: update linter dockerfile to use go 1.21.8
This was done with scripts/update-go-version.sh
* wormchain: update ibc-relayer to use go 1.21.8
This was done with scripts/update-go-version.sh
* scripts: add update-go-version.sh
This is a little helper to make updating the version of go a bit nicer.
* scripts: update-go-version.sh fixes
* set the default docker command to "dokcer"
* update the comment for the humongous sed command for dockerfiles
* github: fix go linting
* Upgrade golangci-lint to a version built with go 1.21.x. The older
version was a binary version built with go 1.20.x and it was failing
against the newer code built with go 1.21.x
* print the golangci-lint version in each run to see what version of go
it was built with in case there are incompatibilties during the next
upgrade
* remove the linter config skipping over pkg/supervisor entirely and
instead put in an override to ignore the `unused` linter for the
pkg/supervisor testhelpers bits for unsed test functions necessary
to satisfy the test interface.
* scripts: update golang linter cli invocation
* github: use the latest version of golangci-lint
Because 1.52.2 is built with go 1.20.x which has issues with this project
now that it is upgraded to 1.21.8.
* node: remove implicit memory aliasing in a loop
Caught by an upgraded golangci-lint with the gosec linter:
::medium file=node/pkg/watchers/evm/connectors/batch_poller.go,line=226,col=8::G601: Implicit memory aliasing in for loop. (gosec)
::medium file=node/pkg/watchers/evm/connectors/batch_poller.go,line=285,col=8::G601: Implicit memory aliasing in for loop. (gosec)
::medium file=node/pkg/watchers/evm/connectors/batch_poller_test.go,line=128,col=37::G601: Implicit memory aliasing in for loop. (gosec)
See also: https://husni.dev/beware-of-implicit-memory-aliasing-in-go-foor-loop/
* node: update logging
* Update go to 1.21.9
Automated via:
scripts/update-go-version.sh 1.21.9
* node: update test root context teardown time
Otherwise things get really sad.
* scripts: additions to update-go-versions.sh
* Standardized on prefacing functions with `function` for consistency
* Added a few more comments to explain how things work
* Automatically increment the go version and toolchain in go.mod
* Standardized on prefacing functions with `function` for consistency
* Make the go image debian version a variable for ease of maintenance
* node: update go.mod to specify 1.21.9
* node: update node tests
Review feedback from @pires
* scripts: run go mod tidy in update-go-version.sh
Required after running go mod edit or it refuses to build.
* node: update go.mod
Running `go mod tidy` removes the toolchain so the build works.
* node: update node tests
---------
Co-authored-by: Ryan Hamphrey <hamphreyryan26@gmail.com>
* deployments: update for guardian set index v4
Wormholescan returns vaas base64 encoded, but guardianSetVAAs.csv
has them in hex format. This is the correct command to download a
guardian set upgrade vaa and convert it to hex in one go:
curl -sq 0000000000000000000000000000000004/18252082506122526004 | \
jq .vaaBytes -r | \
base64 -d | \
xxd -p | \
tr -d '\n'
echo
Refs: wormhole-foundation/wormhole-networks#53
* node: update admin template gsti to 4
Refs: wormhole-foundation/wormhole-networks#53