This repository has been archived by the owner on Dec 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Required gas, events, reentrancy, go linter #66
Merged
Merged
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a7c7155
required gas and events
1d149b8
reentrancy guards
1050d93
add go linter
f788115
Merge remote-tracking branch 'origin/main' into required-gas
2ade0d4
Merge remote-tracking branch 'origin/main' into required-gas
6c8f6e2
update required gas and bindings
a155e4f
passing in required gas
49de7b2
passing in required gas limit
4812397
lint and bindings update
833219c
fixing e2e tests
eda6632
use input.requiredGasLimit for source as well
7b5879d
comment updates
20ab9db
updating bindings
c26d823
Merge remote-tracking branch 'origin/main' into required-gas
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# This file configures github.com/golangci/golangci-lint. | ||
|
||
run: | ||
timeout: 3m | ||
tests: true | ||
# skip auto-generated files. | ||
skip-dirs: | ||
- "abi-bindings/go" | ||
skip-files: | ||
- ".*mock.*" | ||
|
||
issues: | ||
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3. | ||
max-same-issues: 0 | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- goimports | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- misspell | ||
- unconvert | ||
- unused | ||
- whitespace | ||
- lll | ||
|
||
linters-settings: | ||
gofmt: | ||
simplify: true |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
207 changes: 161 additions & 46 deletions
207
abi-bindings/go/NativeTokenSource/NativeTokenSource.go
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,16 +18,16 @@ import {ITeleporterReceiver} from "@teleporter/ITeleporterReceiver.sol"; | |
* @param destinationBridgeAddress address of the destination token bridge instance | ||
* @param recipient address of the recipient on the destination chain | ||
* @param primaryFee amount of tokens to pay for Teleporter fee on the source chain | ||
* @param secondaryFee amount of tokens to pay for Teleporter fee if a multihop is needed. | ||
* @param allowedRelayerAddresses addresses of relayers allowed to send the message | ||
* @param secondaryFee amount of tokens to pay for Teleporter fee if a multihop is needed | ||
* @param requiredGasLimit gas limit requirement for sending to a destination token bridge | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain that this is required because a source/destination bridge contracts are able to call arbitrary code? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated comment |
||
*/ | ||
struct SendTokensInput { | ||
bytes32 destinationBlockchainID; | ||
address destinationBridgeAddress; | ||
address recipient; | ||
uint256 primaryFee; | ||
uint256 secondaryFee; | ||
address[] allowedRelayerAddresses; | ||
uint256 requiredGasLimit; | ||
} | ||
|
||
/** | ||
|
@@ -36,7 +36,16 @@ struct SendTokensInput { | |
interface ITeleporterTokenBridge is ITeleporterReceiver { | ||
/** | ||
* @notice Emitted when tokens are sent to another chain. | ||
* TODO: might want to add SendTokensInput as a parameter | ||
*/ | ||
event SendTokens(bytes32 indexed teleporterMessageID, address indexed sender, uint256 amount); | ||
event SendTokens( | ||
bytes32 indexed teleporterMessageID, | ||
address indexed sender, | ||
SendTokensInput input, | ||
uint256 amount | ||
); | ||
|
||
/** | ||
* @notice Emitted when tokens are withdrawn from the token bridge contract. | ||
*/ | ||
event WithdrawTokens(address indexed recipient, uint256 amount); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few asks for this comment:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated comment to clarify