Skip to content

Commit

Permalink
Update for rcnet-v2 phase 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
siy committed Aug 3, 2023
1 parent d753568 commit 3c81dfe
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "babylon-ledger-app"
version = "0.5.3"
version = "0.5.4"
authors = ["siy"]
edition = "2021"
description = "Radix Babylon"
Expand Down
8 changes: 4 additions & 4 deletions sbor/src/print/instruction_printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,9 @@ mod tests {
check_partial_decoding(
&TX_ACCESS_RULE,
br##"
1 of 3: CallRoleAssignmentMethod Enum<0u8>(Address(resource_loc1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxue22t7al), ) "set_owner" Tuple(Enum<0u8>(), )
2 of 3: CallRoleAssignmentMethod Enum<0u8>(Address(resource_loc1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxue22t7al), ) "lock_owner" Tuple()
3 of 3: CallRoleAssignmentMethod Enum<0u8>(Address(resource_loc1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxue22t7al), ) "set" Tuple(Enum<0u8>(), "hello", Enum<0u8>(), )
1 of 3: CallRoleAssignmentMethod Enum<0u8>(Address(resource_loc1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxue22t7al), ) "set_owner_role" Tuple(Enum<0u8>(), )
2 of 3: CallRoleAssignmentMethod Enum<0u8>(Address(resource_loc1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxue22t7al), ) "lock_owner_role" Tuple()
3 of 3: CallRoleAssignmentMethod Enum<0u8>(Address(resource_loc1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxue22t7al), ) "set_role" Tuple(Enum<0u8>(), "hello", Enum<0u8>(), )
"##,
&DetectedTxType::Other(None),
);
Expand Down Expand Up @@ -604,7 +604,7 @@ br##"
1 of 4: CallMethod Enum<0u8>(Address(component_loc1cqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve2jtvlp), ) "complicated_method" Tuple(Decimal(1), PreciseDecimal(2), )
2 of 4: CallRoyaltyMethod Enum<0u8>(Address(component_loc1cqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve2jtvlp), ) "set_royalty" Tuple("my_method", Enum<0u8>(), )
3 of 4: CallMetadataMethod Enum<0u8>(Address(component_loc1cqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve2jtvlp), ) "get" Tuple("HelloWorld", )
4 of 4: CallRoleAssignmentMethod Enum<0u8>(Address(component_loc1cqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve2jtvlp), ) "get" Tuple(Enum<0u8>(), "hello", )
4 of 4: CallRoleAssignmentMethod Enum<0u8>(Address(component_loc1cqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve2jtvlp), ) "get_role" Tuple(Enum<0u8>(), "hello", )
"##,
&DetectedTxType::Other(None),
);
Expand Down
38 changes: 20 additions & 18 deletions sbor/src/tx_intent_test_data.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
#[cfg(test)]
pub mod tests {
pub const TX_ACCESS_RULE_HASH: [u8; 32] = [
0x00, 0x18, 0x52, 0x16, 0x4e, 0x1c, 0xfc, 0x3b, 0x03, 0xb0, 0x90, 0x21, 0xeb, 0xf2, 0x09,
0xf4, 0xd3, 0xf2, 0x62, 0xe1, 0xa2, 0x99, 0x88, 0xa4, 0x11, 0x4a, 0xc5, 0x84, 0x35, 0x3e,
0xf7, 0x44,
0xf9, 0xb2, 0x36, 0xcd, 0xa2, 0x61, 0x6a, 0x4a, 0x95, 0xa7, 0x59, 0xda, 0xed, 0x6e, 0x2b,
0xbe, 0x50, 0x7b, 0x0d, 0xda, 0xf4, 0x4b, 0x7d, 0x4c, 0x49, 0x76, 0xf6, 0x3f, 0x4d, 0x52,
0x92, 0xb7,
];
pub const TX_ACCESS_RULE: [u8; 244] = [
pub const TX_ACCESS_RULE: [u8; 259] = [
0x4d, 0x22, 0x01, 0x04, 0x21, 0x07, 0x07, 0xf2, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0a, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x05, 0x00, 0x00,
0x00, 0x22, 0x01, 0x01, 0x20, 0x07, 0x20, 0xf3, 0x81, 0x62, 0x6e, 0x41, 0xe7, 0x02, 0x7e,
0xa4, 0x31, 0xbf, 0xe3, 0x00, 0x9e, 0x94, 0xbd, 0xd2, 0x5a, 0x74, 0x6b, 0xee, 0xc4, 0x68,
0x94, 0x8d, 0x6c, 0x3c, 0x7c, 0x5d, 0xc9, 0xa5, 0x4b, 0x01, 0x00, 0x08, 0x03, 0x00, 0x20,
0x22, 0x03, 0x44, 0x03, 0x22, 0x00, 0x01, 0x80, 0x00, 0x5d, 0xd8, 0xee, 0x1d, 0xb7, 0xd7,
0xed, 0x52, 0x17, 0x73, 0x5e, 0x77, 0x66, 0x49, 0x54, 0x77, 0xfe, 0x03, 0xf5, 0xa0, 0xaa,
0xa1, 0x61, 0x71, 0x21, 0xae, 0xce, 0xe3, 0x1b, 0x99, 0x0c, 0x09, 0x73, 0x65, 0x74, 0x5f,
0x6f, 0x77, 0x6e, 0x65, 0x72, 0x21, 0x01, 0x22, 0x00, 0x00, 0x44, 0x03, 0x22, 0x00, 0x01,
0x80, 0x00, 0x5d, 0xd8, 0xee, 0x1d, 0xb7, 0xd7, 0xed, 0x52, 0x17, 0x73, 0x5e, 0x77, 0x66,
0x49, 0x54, 0x77, 0xfe, 0x03, 0xf5, 0xa0, 0xaa, 0xa1, 0x61, 0x71, 0x21, 0xae, 0xce, 0xe3,
0x1b, 0x99, 0x0c, 0x0a, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x21,
0x00, 0x44, 0x03, 0x22, 0x00, 0x01, 0x80, 0x00, 0x5d, 0xd8, 0xee, 0x1d, 0xb7, 0xd7, 0xed,
0x52, 0x17, 0x73, 0x5e, 0x77, 0x66, 0x49, 0x54, 0x77, 0xfe, 0x03, 0xf5, 0xa0, 0xaa, 0xa1,
0x61, 0x71, 0x21, 0xae, 0xce, 0xe3, 0x1b, 0x99, 0x0c, 0x03, 0x73, 0x65, 0x74, 0x21, 0x03,
0xa1, 0x61, 0x71, 0x21, 0xae, 0xce, 0xe3, 0x1b, 0x99, 0x0c, 0x0e, 0x73, 0x65, 0x74, 0x5f,
0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x21, 0x01, 0x22, 0x00, 0x00,
0x44, 0x03, 0x22, 0x00, 0x01, 0x80, 0x00, 0x5d, 0xd8, 0xee, 0x1d, 0xb7, 0xd7, 0xed, 0x52,
0x17, 0x73, 0x5e, 0x77, 0x66, 0x49, 0x54, 0x77, 0xfe, 0x03, 0xf5, 0xa0, 0xaa, 0xa1, 0x61,
0x71, 0x21, 0xae, 0xce, 0xe3, 0x1b, 0x99, 0x0c, 0x0f, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6f,
0x77, 0x6e, 0x65, 0x72, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x21, 0x00, 0x44, 0x03, 0x22, 0x00,
0x01, 0x80, 0x00, 0x5d, 0xd8, 0xee, 0x1d, 0xb7, 0xd7, 0xed, 0x52, 0x17, 0x73, 0x5e, 0x77,
0x66, 0x49, 0x54, 0x77, 0xfe, 0x03, 0xf5, 0xa0, 0xaa, 0xa1, 0x61, 0x71, 0x21, 0xae, 0xce,
0xe3, 0x1b, 0x99, 0x0c, 0x08, 0x73, 0x65, 0x74, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x21, 0x03,
0x22, 0x00, 0x00, 0x0c, 0x05, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x22, 0x00, 0x00, 0x20, 0x20,
0x00, 0x22, 0x00, 0x00,
];
Expand Down Expand Up @@ -91,11 +92,11 @@ pub mod tests {
0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x20, 0x00, 0x22, 0x00, 0x00,
];
pub const TX_CALL_METHOD_HASH: [u8; 32] = [
0xa3, 0xea, 0x60, 0xda, 0xbd, 0x81, 0x0d, 0x91, 0xb7, 0x5c, 0xb9, 0xb9, 0xb0, 0x2e, 0xfd,
0x08, 0xeb, 0x5e, 0x89, 0xee, 0x10, 0xcf, 0xad, 0x38, 0x96, 0x1e, 0x69, 0x76, 0x7d, 0x37,
0x44, 0xa9,
0x45, 0x59, 0xbc, 0x0b, 0xd7, 0x6a, 0x63, 0x39, 0x3b, 0x19, 0xf1, 0xc7, 0xd1, 0xd2, 0x9e,
0x27, 0x5d, 0x9a, 0x2d, 0x3e, 0xe5, 0xaa, 0x5c, 0x0b, 0xeb, 0x4d, 0x2e, 0xc0, 0x60, 0xf6,
0xa2, 0x3a,
];
pub const TX_CALL_METHOD: [u8; 416] = [
pub const TX_CALL_METHOD: [u8; 421] = [
0x4d, 0x22, 0x01, 0x04, 0x21, 0x07, 0x07, 0xf2, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0a, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x05, 0x00, 0x00,
0x00, 0x22, 0x01, 0x01, 0x20, 0x07, 0x20, 0xf3, 0x81, 0x62, 0x6e, 0x41, 0xe7, 0x02, 0x7e,
Expand All @@ -122,8 +123,9 @@ pub mod tests {
0x0a, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x44, 0x03, 0x22, 0x00,
0x01, 0x80, 0x00, 0xc0, 0x18, 0x83, 0x46, 0x2f, 0x39, 0x79, 0x6d, 0xa8, 0x3f, 0x2f, 0x82,
0xca, 0xef, 0xa6, 0x79, 0xaa, 0xf1, 0xf1, 0x89, 0x25, 0x7e, 0xbd, 0x3c, 0x8c, 0x27, 0x7d,
0x5a, 0xe1, 0x99, 0x0c, 0x03, 0x67, 0x65, 0x74, 0x21, 0x02, 0x22, 0x00, 0x00, 0x0c, 0x05,
0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x20, 0x00, 0x22, 0x00, 0x00,
0x5a, 0xe1, 0x99, 0x0c, 0x08, 0x67, 0x65, 0x74, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x21, 0x02,
0x22, 0x00, 0x00, 0x0c, 0x05, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x20, 0x00, 0x22, 0x00,
0x00,
];
pub const TX_CREATE_ACCESS_CONTROLLER_HASH: [u8; 32] = [
0x90, 0xba, 0xc0, 0x2f, 0x91, 0xa8, 0xdf, 0x81, 0x52, 0x4c, 0xac, 0x32, 0x1a, 0x1d, 0xe3,
Expand Down
Binary file modified test/data/access_rule.txn
Binary file not shown.
Binary file modified test/data/call_method.txn
Binary file not shown.
2 changes: 1 addition & 1 deletion test/test-get-application-version.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
print("Testing", "GetAppVersion", instructionCode, end=" ")
response = dongle.exchange(bytes.fromhex(instructionClass + instructionCode + p1 + p2 + dataLength))

assert response.hex() == '000503', "Invalid version\nReceived:" + response.hex()
assert response.hex() == '000504', "Invalid version\nReceived:" + response.hex()
print("Success")

0 comments on commit 3c81dfe

Please sign in to comment.