Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Migrate from address maps to address lookup tables (#21634) (#21773)
Browse files Browse the repository at this point in the history
* Migrate from address maps to address lookup tables

* update sanitize error

* cargo fmt

* update abi

(cherry picked from commit 6c108c8)

Co-authored-by: Justin Starry <[email protected]>
  • Loading branch information
mergify[bot] and jstarry authored Dec 10, 2021
1 parent ef51778 commit 2a6bb2b
Show file tree
Hide file tree
Showing 11 changed files with 610 additions and 610 deletions.
17 changes: 9 additions & 8 deletions accountsdb-plugin-postgres/scripts/create_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -113,27 +113,28 @@ CREATE TYPE "TransactionMessage" AS (
instructions "CompiledInstruction"[]
);

CREATE TYPE "AddressMapIndexes" AS (
writable SMALLINT[],
readonly SMALLINT[]
CREATE TYPE "TransactionMessageAddressTableLookup" AS (
account_key: BYTEA[],
writable_indexes SMALLINT[],
readonly_indexes SMALLINT[]
);

CREATE TYPE "TransactionMessageV0" AS (
header "TransactionMessageHeader",
account_keys BYTEA[],
recent_blockhash BYTEA,
instructions "CompiledInstruction"[],
address_map_indexes "AddressMapIndexes"[]
address_table_lookups "TransactionMessageAddressTableLookup"[]
);

CREATE TYPE "MappedAddresses" AS (
CREATE TYPE "LoadedAddresses" AS (
writable BYTEA[],
readonly BYTEA[]
);

CREATE TYPE "MappedMessage" AS (
CREATE TYPE "LoadedMessageV0" AS (
message "TransactionMessageV0",
mapped_addresses "MappedAddresses"
loaded_addresses "LoadedAddresses"
);

-- The table storing transactions
Expand All @@ -143,7 +144,7 @@ CREATE TABLE transaction (
is_vote BOOL NOT NULL,
message_type SMALLINT, -- 0: legacy, 1: v0 message
legacy_message "TransactionMessage",
v0_mapped_message "MappedMessage",
v0_loaded_message "LoadedMessageV0",
signatures BYTEA[],
message_hash BYTEA,
meta "TransactionStatusMeta",
Expand Down
6 changes: 3 additions & 3 deletions accountsdb-plugin-postgres/scripts/drop_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ DROP TABLE transaction;

DROP TYPE "TransactionError" CASCADE;
DROP TYPE "TransactionErrorCode" CASCADE;
DROP TYPE "MappedMessage" CASCADE;
DROP TYPE "MappedAddresses" CASCADE;
DROP TYPE "LoadedMessageV0" CASCADE;
DROP TYPE "LoadedAddresses" CASCADE;
DROP TYPE "TransactionMessageV0" CASCADE;
DROP TYPE "AddressMapIndexes" CASCADE;
DROP TYPE "TransactionMessage" CASCADE;
DROP TYPE "TransactionMessageHeader" CASCADE;
DROP TYPE "TransactionMessageAddressTableLookup" CASCADE;
DROP TYPE "TransactionStatusMeta" CASCADE;
DROP TYPE "RewardType" CASCADE;
DROP TYPE "Reward" CASCADE;
Expand Down
Loading

0 comments on commit 2a6bb2b

Please sign in to comment.