Skip to content

Commit 73723a9

Browse files
Merge pull request #244 from anoma/feat/increase-masp-tx-gas-limits
feat: increase masp txs gas limit + tx id hashes to lowercase
2 parents 7d1ad97 + 1fde4db commit 73723a9

File tree

10 files changed

+70
-7
lines changed

10 files changed

+70
-7
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ authors = ["Heliax <hello@heliax.dev>"]
88
edition = "2021"
99
license = "GPL-3.0"
1010
readme = "README.md"
11-
version = "1.1.4"
11+
version = "1.1.5"
1212

1313
[workspace.dependencies]
1414
clokwerk = "0.4.0"
@@ -85,4 +85,4 @@ fake = { version = "2.10.0", features = ["derive"] }
8585
rand = "0.8.5"
8686
bigdecimal = "0.4.5"
8787
strum = "0.26.3"
88-
strum_macros = "0.26.3"
88+
strum_macros = "0.26.3"

justfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ check:
55
cargo check --all
66

77
fmt:
8-
cargo +nightly fmt --all
8+
cargo +nightly-2024-06-14 fmt --all
9+
10+
fmt-check:
11+
cargo +nightly-2024-06-14 fmt --all --check
912

1013
test:
1114
cargo test
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
DROP TABLE IF EXISTS ibc_ack;
1+
DROP TABLE IF EXISTS ibc_ack;
2+
3+
DROP TYPE IF EXISTS IBC_STATUS;
Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,35 @@
11
-- This file should undo anything in `up.sql`
2-
DROP TYPE IBC_STATUS;
2+
3+
-- Step 1: Rename the existing enum type
4+
ALTER TYPE TRANSACTION_KIND RENAME TO TRANSACTION_KIND_OLD;
5+
6+
-- Step 2: Create the new enum type without the added values
7+
CREATE TYPE TRANSACTION_KIND AS ENUM (
8+
'transparent_transfer',
9+
'shielded_transfer',
10+
'shielding_transfer',
11+
'unshielding_transfer',
12+
'ibc_msg_transfer',
13+
'bond',
14+
'redelegation',
15+
'unbond',
16+
'withdraw',
17+
'claim_rewards',
18+
'vote_proposal',
19+
'init_proposal',
20+
'change_metadata',
21+
'change_commission',
22+
'reveal_pk',
23+
'become_validator',
24+
'unknown'
25+
);
26+
27+
-- Step 3: Update all columns to use the new enum type
28+
ALTER TABLE inner_transactions ALTER COLUMN kind TYPE TRANSACTION_KIND
29+
USING kind::text::TRANSACTION_KIND;
30+
31+
ALTER TABLE gas ALTER COLUMN tx_kind TYPE TRANSACTION_KIND
32+
USING tx_kind::text::TRANSACTION_KIND;
33+
34+
-- Step 4: Drop the old enum type
35+
DROP TYPE TRANSACTION_KIND_OLD;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
11
-- This file should undo anything in `up.sql`
2+
3+
-- Step 1: Rename the existing enum type
4+
ALTER TYPE VALIDATOR_STATE RENAME TO VALIDATOR_STATE_OLD;
5+
6+
-- Step 2: Create the new enum type without the added values
7+
CREATE TYPE VALIDATOR_STATE AS ENUM ('consensus', 'inactive', 'jailed', 'below_capacity', 'below_threshold', 'unknown');
8+
9+
-- Step 3: Update all columns to use the new enum type
10+
ALTER TABLE validators ALTER COLUMN state TYPE VALIDATOR_STATE
11+
USING state::text::VALIDATOR_STATE;
12+
13+
-- Step 4: Drop the old enum type
14+
DROP TYPE VALIDATOR_STATE_OLD;
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
-- This file should undo anything in `up.sql`
2-
DROP TABLE transaction_history;
2+
DROP TABLE transaction_history;
3+
4+
DROP TYPE IF EXISTS HISTORY_KIND;

orm/migrations/2024-12-17-103655_transaction_history/up.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ CREATE TABLE transaction_history (
1010
);
1111

1212
CREATE UNIQUE INDEX index_transaction_history_target_inner_tx_id ON transaction_history(inner_tx_id, target, kind);
13-
CREATE INDEX index_transaction_history_target ON transaction_history (target);
13+
CREATE INDEX index_transaction_history_target ON transaction_history (target);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- This file should undo anything in `up.sql`
2+
3+
UPDATE gas SET gas_limit = 50_000 WHERE tx_kind = 'shielded_transfer';
4+
UPDATE gas SET gas_limit = 50_000 WHERE tx_kind = 'unshielding_transfer';
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- Your SQL goes here
2+
3+
UPDATE gas SET gas_limit = 60_000 WHERE tx_kind = 'shielded_transfer';
4+
UPDATE gas SET gas_limit = 60_000 WHERE tx_kind = 'unshielding_transfer';

webserver/src/handler/transaction.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub async fn get_wrapper_tx(
2020
State(state): State<CommonState>,
2121
) -> Result<Json<Option<WrapperTransaction>>, ApiError> {
2222
is_valid_hash(&tx_id)?;
23+
let tx_id = tx_id.to_lowercase();
2324

2425
let wrapper_tx = state
2526
.transaction_service
@@ -49,6 +50,7 @@ pub async fn get_inner_tx(
4950
State(state): State<CommonState>,
5051
) -> Result<Json<Option<InnerTransaction>>, ApiError> {
5152
is_valid_hash(&tx_id)?;
53+
let tx_id = tx_id.to_lowercase();
5254

5355
let inner_tx = state
5456
.transaction_service

0 commit comments

Comments
 (0)