Skip to content

Commit 2c4bc07

Browse files
authored
feat(target_chains/fuel): bump fuel-toolchain and refactor (#1794)
* bump fuel-toolchain and refactor * remove troubleshooting log * redeploy * precommit
1 parent b3c4156 commit 2c4bc07

24 files changed

+368
-348
lines changed

target_chains/fuel/contracts/Cargo.lock

Lines changed: 202 additions & 230 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

target_chains/fuel/contracts/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ license = "Apache-2.0"
99
[dependencies]
1010
rand = "0.8.5"
1111
base64 = "0.22"
12-
fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
12+
fuels = { version = "0.65.1", features = ["fuel-core-lib"] }
1313
tokio = { version = "1.12", features = ["rt", "macros"] }
1414
hex = "0.4.3"
1515
reqwest = "0.11.27"

target_chains/fuel/contracts/Forc.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[[package]]
22
name = "core"
3-
source = "path+from-root-E19CE48B3E858B72"
3+
source = "path+from-root-2AB5BCE55EAAEFF4"
44

55
[[package]]
66
name = "pyth-contract"
@@ -32,7 +32,7 @@ dependencies = ["std"]
3232

3333
[[package]]
3434
name = "std"
35-
source = "git+https://github.com/fuellabs/sway?tag=v0.60.0#2f0392ee35a1e4dd80bd8034962d5b4083dfb8b6"
35+
source = "git+https://github.com/fuellabs/sway?tag=v0.62.0#efda0397c7bee77de73bd726ec0b732d57614973"
3636
dependencies = ["core"]
3737

3838
[[package]]

target_chains/fuel/contracts/README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
# Pyth-integration
22

3-
> **_NOTE:_** The project is a WIP.
4-
53
An implementation of a [Pyth Network](https://pyth.network/) oracle contract in Sway. Utilising minimal, internal [Wormhole](https://docs.wormhole.com/wormhole/) functionality and state.
64

75
## Interfaces
86

97
The project provides four interfaces for interaction with the oracle contract:
108

11-
- [PythCore](./pyth-interface/src/interface.sw#L20) - provides the core functionality to required to utilise the oracle; getting fees, updating prices and fetching prices.
12-
- [PythInit](./pyth-interface/src/interface.sw#L250) - provides the functionality to setup the oracle's state.
13-
- [PythInfo](./pyth-interface/src/interface.sw#L255) - provides additional information about the oracle's state.
14-
- [WormholeGuardians](./pyth-interface/src/interface.sw#L283) - provides functionality to maintain and query the wormhole-state-elements used by the oracle.
9+
- [PythCore](./pyth-interface/src/interface.sw#L24) - provides the core functionality to required to utilise the oracle; getting fees, updating prices and fetching prices.
10+
- [PythInit](./pyth-interface/src/interface.sw#L263) - provides the functionality to setup the oracle's state.
11+
- [PythInfo](./pyth-interface/src/interface.sw#L277) - provides additional information about the oracle's state.
12+
- [WormholeGuardians](./pyth-interface/src/interface.sw#L308) - provides functionality to maintain and query the wormhole-state-elements used by the oracle.
1513

1614
## Running the project
1715

@@ -37,7 +35,7 @@ cargo test
3735

3836
Before deploying the oracle contract; the `deployer` must be set to the address of the deploying wallet in the storage block, so that the deployer can setup the contract with the `constructor()` method.
3937

40-
Parameters for the `constructor()` method can be seen in the [tests of the method](./pyth-contract/tests/functions/pyth_init/constuctor.rs#L28), which at the time of writing uses the real up-to-date values as per Pyth's documentation and EVM integrations. Care should be taken to ensure that the most up-to-date values are used for the `constructor()` method's parameters.
38+
Parameters for the `constructor()` method can be seen in the [tests of the method](./tests/utils/interface/pyth_init.rs#L7), which at the time of writing uses the real up-to-date values as per Pyth's documentation and EVM integrations. Care should be taken to ensure that the most up-to-date values are used for the `constructor()` method's parameters.
4139

4240
#### Fuel Beta-5 network deployment:
4341

target_chains/fuel/contracts/fuel-toolchain.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
channel = "latest-aarch64-apple-darwin"
33

44
[components]
5-
forc = "0.60.0"
6-
fuel-core = "0.26.0"
5+
forc = "0.62.0"
6+
fuel-core = "0.31.0"

target_chains/fuel/contracts/pyth-contract/out/release/pyth-contract-abi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1838,7 +1838,7 @@
18381838
"type": 6,
18391839
"typeArguments": []
18401840
},
1841-
"offset": 129616
1841+
"offset": 117008
18421842
}
18431843
]
18441844
}
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
[
22
{
3-
"key": "6294951dcb0a9111a517be5cf4785670ff4e166fb5ab9c33b17e6881b48e964f",
3+
"key": "11672498f6e54d64f7c94ceafab63ce9c33b957b083d82f9301e18c4bbcdd43e",
44
"value": "0000000000000000000000000000000000000000000000000000000000000000"
55
},
66
{
7-
"key": "71217a24656901c411894bb65eb78a828dafa5a6844488ef5024eb5ac0cff79c",
7+
"key": "1fea2a1870fafe58b3f658d2a10d75f7d4b599036bb925958e3650097753f03f",
88
"value": "0000000000000000000000000000000000000000000000000000000000000000"
99
},
1010
{
11-
"key": "71217a24656901c411894bb65eb78a828dafa5a6844488ef5024eb5ac0cff79d",
11+
"key": "1fea2a1870fafe58b3f658d2a10d75f7d4b599036bb925958e3650097753f040",
1212
"value": "0000000000000000000000000000000000000000000000000000000000000000"
1313
},
1414
{
15-
"key": "7f91d1a929dce734e7f930bbb279ccfccdb5474227502ea8845815c74bd930a7",
15+
"key": "1feab27058c4ed60cb36c15c123efafc983fdbc10f4cfac4f1b23fdb8c36fb7d",
1616
"value": "0000000000000000000000000000000000000000000000000000000000000000"
1717
},
1818
{
19-
"key": "8a89a0cce819e0426e565819a9a98711329087da5a802fb16edd223c47fa44ef",
19+
"key": "1feab27058c4ed60cb36c15c123efafc983fdbc10f4cfac4f1b23fdb8c36fb7e",
2020
"value": "0000000000000000000000000000000000000000000000000000000000000000"
2121
},
2222
{
23-
"key": "94b2b70d20da552763c7614981b2a4d984380d7ed4e54c01b28c914e79e44bd5",
23+
"key": "2978ac0e4bdc20e0a96c04e8adb0639e5efdff01601aa4f7887421e795e4b96a",
2424
"value": "0000000000000000000000000000000000000000000000000000000000000000"
2525
},
2626
{
27-
"key": "94b2b70d20da552763c7614981b2a4d984380d7ed4e54c01b28c914e79e44bd6",
27+
"key": "357565afd3b58fa5509545cd95377655dcb331b733af6f4439699d27dcf450eb",
2828
"value": "0000000000000000000000000000000000000000000000000000000000000000"
2929
},
3030
{
31-
"key": "a9203bbb8366ca9d708705dce980acbb54d44fb753370ffe4c7d351b46b2abbc",
31+
"key": "358560d9e39bf0d62ad9ffeba18c167b0e4e6722c6eb24f55cbc64054c51b905",
3232
"value": "0000000000000000000000000000000000000000000000000000000000000000"
3333
},
3434
{
35-
"key": "b48b753af346966d0d169c0b2e3234611f65d5cfdb57c7b6e7cd6ca93707bee0",
35+
"key": "358560d9e39bf0d62ad9ffeba18c167b0e4e6722c6eb24f55cbc64054c51b906",
3636
"value": "0000000000000000000000000000000000000000000000000000000000000000"
3737
},
3838
{
39-
"key": "c7e08cdde76020f08f4ce5c3257422ae67f9676992689b64b85f35aa58752d9e",
39+
"key": "480744474aef380dda93aae5f17de10f991ca301c7ae8a925ab40229da966cf8",
4040
"value": "0000000000000000000000000000000000000000000000000000000000000000"
4141
},
4242
{
43-
"key": "c7e08cdde76020f08f4ce5c3257422ae67f9676992689b64b85f35aa58752d9f",
43+
"key": "d16fb5609ac0a5d5c45145524cbd88ae218f3be85b76bb42239b7eb916305d6d",
4444
"value": "0000000000000000000000000000000000000000000000000000000000000000"
4545
},
4646
{
47-
"key": "d02e07f5a716bd3b6670aaf9a73352164e6b946c24db14f72005b7029e67d96a",
47+
"key": "f9e12c6c1c57daf9e6a5ff000b582628bec999880e26917559121db757ba5653",
4848
"value": "0000000000000000000000000000000000000000000000000000000000000000"
4949
}
5050
]
Binary file not shown.

target_chains/fuel/contracts/pyth-interface/src/data_structures/price.sw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ impl PriceFeed {
333333
let (_, slice) = encoded_proof.split_at(current_offset);
334334
let (encoded_message, _) = slice.split_at(message_size);
335335
current_offset += message_size;
336-
let end_offset = validate_proof(encoded_proof, current_offset, digest, encoded_message);
336+
let end_offset = validate_proof(encoded_proof, current_offset, digest, encoded_message.clone());
337337
// Message type of 0 is a Price Feed
338338
require(
339339
encoded_message

target_chains/fuel/contracts/pyth-interface/src/pyth_merkle_proof.sw

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ pub fn validate_proof(
4242
leaf_data: Bytes,
4343
) -> u64 {
4444
let mut current_digest = leaf_hash(leaf_data);
45-
4645
let proof_size = encoded_proof.get(proof_offset).unwrap().as_u64();
4746
proof_offset += 1;
4847

0 commit comments

Comments
 (0)