-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat!: add support for abi errors #1651
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
70df2f8
feat!: add support for abi errors
hal3e 1d74222
Merge branch 'master' into feat/abi-errors
hal3e 9996b0f
poc impl
hal3e ef379a6
bump fuel-abi-types to 0.11.0
hal3e 49f33b5
work in progress
hal3e 048d1c8
Merge branch 'master' into feat/abi-errors
hal3e d154f3f
update error message
hal3e a14cc0b
refactor code and add tests
hal3e fc40d9d
refactor
hal3e fe2167e
updace ciyml
hal3e 2197a4a
update ci yml
hal3e b6405ca
fix tests
hal3e 0b93f8d
refactor
hal3e dc4923b
Update packages/fuels-code-gen/src/program_bindings/abigen/bindings/c…
hal3e fc509f2
Update packages/fuels-core/src/types/tx_status.rs
hal3e 60694aa
pr comments
hal3e 5ef0025
pr comments
hal3e 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
authors = ["Fuel Labs <[email protected]>"] | ||
entry = "main.sw" | ||
license = "Apache-2.0" | ||
name = "revert_logs" | ||
name = "contract_revert_logs" |
File renamed without changes.
This file contains hidden or 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
File renamed without changes.
This file contains hidden or 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,96 @@ | ||
script; | ||
hal3e marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
use std::logging::log; | ||
|
||
#[allow(dead_code)] | ||
enum EnumWithGeneric<D> { | ||
VariantOne: D, | ||
VariantTwo: (), | ||
} | ||
|
||
#[allow(dead_code)] | ||
struct StructWithNestedGeneric<D> { | ||
field_1: D, | ||
field_2: u64, | ||
} | ||
|
||
#[allow(dead_code)] | ||
struct StructDeeplyNestedGeneric<D> { | ||
field_1: D, | ||
field_2: u64, | ||
} | ||
|
||
struct B { | ||
id: u64, | ||
val: u64, | ||
} | ||
|
||
#[error_type] | ||
enum MyError { | ||
#[error(m = "some error A")] | ||
A: (), | ||
#[error(m = "some complex error B")] | ||
B: B, | ||
} | ||
|
||
#[allow(dead_code)] | ||
enum MatchEnum { | ||
RequirePrimitive: (), | ||
RequireString: (), | ||
RequireCustomGeneric: (), | ||
RequireWithAdditionalLogs: (), | ||
RevWLogPrimitive: (), | ||
RevWLogString: (), | ||
RevWLogCustomGeneric: (), | ||
Panic: (), | ||
PanicError: (), | ||
} | ||
|
||
fn main(match_enum: MatchEnum) { | ||
match match_enum { | ||
MatchEnum::RequirePrimitive => require(false, 42), | ||
MatchEnum::RequireString => require(false, __to_str_array("fuel")), | ||
MatchEnum::RequireCustomGeneric => { | ||
let l: [u8; 3] = [1u8, 2u8, 3u8]; | ||
|
||
let test_enum = EnumWithGeneric::VariantOne(l); | ||
let test_struct_nested = StructWithNestedGeneric { | ||
field_1: test_enum, | ||
field_2: 64, | ||
}; | ||
let test_deeply_nested_generic = StructDeeplyNestedGeneric { | ||
field_1: test_struct_nested, | ||
field_2: 64, | ||
}; | ||
|
||
require(false, test_deeply_nested_generic); | ||
} | ||
MatchEnum::RequireWithAdditionalLogs => { | ||
log(42); | ||
log(__to_str_array("fuel")); | ||
require(false, 64); | ||
} | ||
MatchEnum::RevWLogPrimitive => revert_with_log(42), | ||
MatchEnum::RevWLogString => revert_with_log(__to_str_array("fuel")), | ||
MatchEnum::RevWLogCustomGeneric => { | ||
let l: [u8; 3] = [1u8, 2u8, 3u8]; | ||
|
||
let test_enum = EnumWithGeneric::VariantOne(l); | ||
let test_struct_nested = StructWithNestedGeneric { | ||
field_1: test_enum, | ||
field_2: 64, | ||
}; | ||
let test_deeply_nested_generic = StructDeeplyNestedGeneric { | ||
field_1: test_struct_nested, | ||
field_2: 64, | ||
}; | ||
|
||
revert_with_log(test_deeply_nested_generic); | ||
} | ||
MatchEnum::Panic => panic "some panic message", | ||
MatchEnum::PanicError => panic MyError::B(B { | ||
id: 42, | ||
val: 36, | ||
}), | ||
} | ||
} |
This file contains hidden or 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 was deleted.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.