Skip to content

Commit

Permalink
[Publishing Tool]: Minor fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
0xOmarA committed Jun 19, 2024
1 parent 12eeaa2 commit 37fc432
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 85 deletions.
31 changes: 0 additions & 31 deletions 98c16ce3e2d33c78ad0d5699983193f4111c724519c10cadd1acf9417e749513

This file was deleted.

2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ state-manager = { git = "https://github.com/radixdlt/babylon-node", rev = "8fb0a

sbor-json = { git = "https://github.com/radixdlt/radix-engine-toolkit", rev = "429dd3de58c0860ddbb8a83e9b57e65a1c0765d1" }

regex = { version = "1.9.3" }

[profile.release]
opt-level = 'z'
lto = true
Expand Down
28 changes: 0 additions & 28 deletions c6cdb2b9b2f7382fce3a3b41963f96d1670ccc67fc2dd546fc9de52fe2829c69

This file was deleted.

12 changes: 6 additions & 6 deletions testing/tests/tests/caviarnine_v1_adapter_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ fn contributions_to_caviarnine_through_adapter_dont_fail_due_to_bucket_ordering(
let result = caviarnine_v1.adapter.open_liquidity_position(
caviarnine_v1.pools.bitcoin.try_into().unwrap(),
buckets,
LockupPeriod::default(),
LockupPeriod::from_seconds(0),
env,
);
results.push(result.is_ok());
Expand Down Expand Up @@ -688,7 +688,7 @@ fn non_strict_testing_of_fees(
.mint_fungible(dec!(100_000), env)?,
ResourceManager(XRD).mint_fungible(dec!(100_000), env)?,
),
LockupPeriod::default(),
LockupPeriod::from_seconds(0),
env,
)?
.pool_units
Expand Down Expand Up @@ -735,7 +735,7 @@ fn non_strict_testing_of_fees(
ResourceManager(XRD)
.mint_fungible(dec!(100_000), env)?,
),
LockupPeriod::default(),
LockupPeriod::from_seconds(0),
env,
)?
.pool_units;
Expand Down Expand Up @@ -1537,7 +1537,7 @@ fn bin_amounts_reported_on_receipt_match_whats_reported_by_caviarnine(
} = caviarnine_v1.adapter.open_liquidity_position(
pool.try_into().unwrap(),
(user_resource_bucket, xrd_bucket),
LockupPeriod::default(),
LockupPeriod::from_seconds(0),
env,
)?;

Expand Down Expand Up @@ -1638,7 +1638,7 @@ fn bin_amounts_reported_on_receipt_match_whats_reported_by_caviarnine_with_price
} = caviarnine_v1.adapter.open_liquidity_position(
pool.try_into().unwrap(),
(user_resource_bucket, xrd_bucket),
LockupPeriod::default(),
LockupPeriod::from_seconds(0),
env,
)?;

Expand Down Expand Up @@ -1739,7 +1739,7 @@ fn bin_amounts_reported_on_receipt_match_whats_reported_by_caviarnine_with_price
} = caviarnine_v1.adapter.open_liquidity_position(
pool.try_into().unwrap(),
(user_resource_bucket, xrd_bucket),
LockupPeriod::default(),
LockupPeriod::from_seconds(0),
env,
)?;

Expand Down
10 changes: 5 additions & 5 deletions testing/tests/tests/defiplaza_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ fn fees_are_zero_when_no_swaps_take_place() -> Result<(), RuntimeError> {
} = defiplaza_v2.adapter.open_liquidity_position(
defiplaza_v2.pools.bitcoin.try_into().unwrap(),
(bitcoin_bucket, xrd_bucket),
LockupPeriod::default(),
LockupPeriod::from_seconds(0),
env,
)?;

Expand Down Expand Up @@ -360,7 +360,7 @@ fn contributions_to_defiplaza_through_adapter_dont_fail_due_to_bucket_ordering(
let result = defiplaza_v2.adapter.open_liquidity_position(
defiplaza_v2.pools.bitcoin.try_into().unwrap(),
buckets,
LockupPeriod::default(),
LockupPeriod::from_seconds(0),
env,
);
results.push(result.is_ok());
Expand Down Expand Up @@ -508,7 +508,7 @@ fn non_strict_testing_of_fees(
.mint_fungible(dec!(100_000), env)?,
ResourceManager(XRD).mint_fungible(dec!(100_000), env)?,
),
LockupPeriod::default(),
LockupPeriod::from_seconds(0),
env,
)?;

Expand Down Expand Up @@ -556,7 +556,7 @@ fn non_strict_testing_of_fees(
ResourceManager(XRD)
.mint_fungible(dec!(100_000), env)?,
),
LockupPeriod::default(),
LockupPeriod::from_seconds(0),
env,
)?
.pool_units;
Expand Down Expand Up @@ -1236,7 +1236,7 @@ fn test_exact_defiplaza_fees_amounts(
} = defiplaza_v2.adapter.open_liquidity_position(
pool.try_into().unwrap(),
(bucket_x, bucket_y),
LockupPeriod::default(),
LockupPeriod::from_seconds(0),
env,
)?;

Expand Down
2 changes: 1 addition & 1 deletion testing/tests/tests/ociswap_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ fn contributions_to_ociswap_through_adapter_dont_fail_due_to_bucket_ordering(
let result = ociswap_v1.adapter.open_liquidity_position(
ociswap_v1.pools.bitcoin.try_into().unwrap(),
buckets,
LockupPeriod::default(),
LockupPeriod::from_seconds(0),
env,
);
results.push(result.is_ok());
Expand Down
6 changes: 3 additions & 3 deletions testing/tests/tests/ociswap_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ fn contributions_to_ociswap_through_adapter_dont_fail_due_to_bucket_ordering(
let result = ociswap_v2.adapter.open_liquidity_position(
ociswap_v2.pools.bitcoin.try_into().unwrap(),
buckets,
LockupPeriod::default(),
LockupPeriod::from_seconds(0),
env,
);
results.push(result.is_ok());
Expand Down Expand Up @@ -479,7 +479,7 @@ fn non_strict_testing_of_fees(
.mint_fungible(dec!(100_000), env)?,
ResourceManager(XRD).mint_fungible(dec!(100_000), env)?,
),
LockupPeriod::default(),
LockupPeriod::from_seconds(0),
env,
)?
.pool_units
Expand Down Expand Up @@ -526,7 +526,7 @@ fn non_strict_testing_of_fees(
ResourceManager(XRD)
.mint_fungible(dec!(100_000), env)?,
),
LockupPeriod::default(),
LockupPeriod::from_seconds(0),
env,
)?
.pool_units;
Expand Down
3 changes: 3 additions & 0 deletions tools/publishing-tool-2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ caviarnine-v1-adapter-v2 = { path = "../../packages/caviarnine-v1-adapter-v2", f

sbor-json = { workspace = true }

reqwest = { version = "0.11.23", features = ["json", "blocking", "multipart"] }
regex = { workspace = true }

hex = { version = "0.4.3" }
rand = { version = "0.8.5" }
macro_rules_attribute = { version = "0.2.0" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ impl GatewayNetworkConnector {
Self {
configuration: Configuration {
base_path: base_url.to_owned(),
client: reqwest::blocking::ClientBuilder::new()
.timeout(None)
.build()
.unwrap(),
..Default::default()
},
network_definition,
Expand Down Expand Up @@ -210,11 +214,24 @@ impl NetworkConnectionProvider for GatewayNetworkConnector {
&mut self,
preview_intent: PreviewIntentV1,
) -> Result<TransactionReceiptV1, Self::Error> {
let string_manifest = decompile(
&preview_intent.intent.instructions.0,
&self.network_definition,
)
.map_err(GatewayExecutorError::ManifestDecompileError)?;
let string_manifest = regex::Regex::new(r"(?m)(\s\s+)")
.unwrap()
.replace_all(
decompile(
&preview_intent.intent.instructions.0,
&self.network_definition,
)
.map_err(GatewayExecutorError::ManifestDecompileError)?
.replace('\n', " ")
.as_str(),
" ",
)
.replace(" ,", ",")
.replace(", ", ",")
.replace(" )", ")")
.replace(") ", ")")
.replace(" (", "(")
.replace("( ", "(");

let blob_hex = preview_intent
.intent
Expand Down Expand Up @@ -260,12 +277,6 @@ impl NetworkConnectionProvider for GatewayNetworkConnector {
skip_epoch_check: preview_intent.flags.skip_epoch_check,
}),
};
std::fs::write(
hex::encode(&blake2b_256_hash(
&serde_json::to_string_pretty(&request).unwrap().as_bytes(),
)),
serde_json::to_string_pretty(&request).unwrap(),
);
let response = transaction_preview(&self.configuration, request)
.map_err(GatewayExecutorError::TransactionPreviewError)?;

Expand Down

0 comments on commit 37fc432

Please sign in to comment.