review fixes
This commit is contained in:
parent
be28c2ab79
commit
22dcf5c72e
@ -1,6 +1,6 @@
|
|||||||
-- +goose Up
|
-- +goose Up
|
||||||
-- +goose StatementBegin
|
-- +goose StatementBegin
|
||||||
-- returns if the state leaf key is vacated (previously existed but now is empty) at the provided block hash
|
-- returns whether the state leaf key is vacated (previously existed but now is empty) at the provided block hash
|
||||||
CREATE OR REPLACE FUNCTION was_state_leaf_removed(v_key VARCHAR(66), v_hash VARCHAR)
|
CREATE OR REPLACE FUNCTION was_state_leaf_removed(v_key VARCHAR(66), v_hash VARCHAR)
|
||||||
RETURNS boolean AS $$
|
RETURNS boolean AS $$
|
||||||
SELECT state_cids.removed = true
|
SELECT state_cids.removed = true
|
||||||
@ -16,7 +16,7 @@ language sql;
|
|||||||
-- +goose StatementEnd
|
-- +goose StatementEnd
|
||||||
|
|
||||||
-- +goose StatementBegin
|
-- +goose StatementBegin
|
||||||
-- returns if the state leaf key is vacated (previously existed but now is empty) at the provided block height
|
-- returns whether the state leaf key is vacated (previously existed but now is empty) at the provided block height
|
||||||
CREATE OR REPLACE FUNCTION public.was_state_leaf_removed_by_number(v_key VARCHAR(66), v_block_no BIGINT)
|
CREATE OR REPLACE FUNCTION public.was_state_leaf_removed_by_number(v_key VARCHAR(66), v_block_no BIGINT)
|
||||||
RETURNS BOOLEAN AS $$
|
RETURNS BOOLEAN AS $$
|
||||||
SELECT state_cids.removed = true
|
SELECT state_cids.removed = true
|
||||||
|
@ -49,7 +49,7 @@ BEGIN
|
|||||||
RAISE NOTICE 'get_storage_at_by_number: chosen header NULL OR % != canonical header % for block number %, trying again.', v_header, v_canonical_header, v_block_no;
|
RAISE NOTICE 'get_storage_at_by_number: chosen header NULL OR % != canonical header % for block number %, trying again.', v_header, v_canonical_header, v_block_no;
|
||||||
TRUNCATE tmp_tt_stg2;
|
TRUNCATE tmp_tt_stg2;
|
||||||
-- If we hit on a non-canonical block, we need to go back and do a comprehensive check.
|
-- If we hit on a non-canonical block, we need to go back and do a comprehensive check.
|
||||||
-- We try to avoid this to avoid joining between storage_cids, state_cids, and header_cids
|
-- We try to avoid this to avoid joining between storage_cids and header_cids
|
||||||
INSERT INTO tmp_tt_stg2
|
INSERT INTO tmp_tt_stg2
|
||||||
SELECT storage_cids.header_id,
|
SELECT storage_cids.header_id,
|
||||||
storage_cids.cid,
|
storage_cids.cid,
|
||||||
@ -62,8 +62,8 @@ BEGIN
|
|||||||
) AS state_leaf_removed
|
) AS state_leaf_removed
|
||||||
FROM eth.storage_cids
|
FROM eth.storage_cids
|
||||||
INNER JOIN eth.header_cids ON (
|
INNER JOIN eth.header_cids ON (
|
||||||
state_cids.header_id = header_cids.block_hash
|
storage_cids.header_id = header_cids.block_hash
|
||||||
AND state_cids.block_number = header_cids.block_number
|
AND storage_cids.block_number = header_cids.block_number
|
||||||
)
|
)
|
||||||
WHERE state_leaf_key = v_state_leaf_key
|
WHERE state_leaf_key = v_state_leaf_key
|
||||||
AND storage_leaf_key = v_storage_leaf_key
|
AND storage_leaf_key = v_storage_leaf_key
|
||||||
|
@ -248,7 +248,7 @@ BEGIN
|
|||||||
RAISE NOTICE 'get_storage_at_by_number: chosen header NULL OR % != canonical header % for block number %, trying again.', v_header, v_canonical_header, v_block_no;
|
RAISE NOTICE 'get_storage_at_by_number: chosen header NULL OR % != canonical header % for block number %, trying again.', v_header, v_canonical_header, v_block_no;
|
||||||
TRUNCATE tmp_tt_stg2;
|
TRUNCATE tmp_tt_stg2;
|
||||||
-- If we hit on a non-canonical block, we need to go back and do a comprehensive check.
|
-- If we hit on a non-canonical block, we need to go back and do a comprehensive check.
|
||||||
-- We try to avoid this to avoid joining between storage_cids, state_cids, and header_cids
|
-- We try to avoid this to avoid joining between storage_cids and header_cids
|
||||||
INSERT INTO tmp_tt_stg2
|
INSERT INTO tmp_tt_stg2
|
||||||
SELECT storage_cids.header_id,
|
SELECT storage_cids.header_id,
|
||||||
storage_cids.cid,
|
storage_cids.cid,
|
||||||
@ -261,8 +261,8 @@ BEGIN
|
|||||||
) AS state_leaf_removed
|
) AS state_leaf_removed
|
||||||
FROM eth.storage_cids
|
FROM eth.storage_cids
|
||||||
INNER JOIN eth.header_cids ON (
|
INNER JOIN eth.header_cids ON (
|
||||||
state_cids.header_id = header_cids.block_hash
|
storage_cids.header_id = header_cids.block_hash
|
||||||
AND state_cids.block_number = header_cids.block_number
|
AND storage_cids.block_number = header_cids.block_number
|
||||||
)
|
)
|
||||||
WHERE state_leaf_key = v_state_leaf_key
|
WHERE state_leaf_key = v_state_leaf_key
|
||||||
AND storage_leaf_key = v_storage_leaf_key
|
AND storage_leaf_key = v_storage_leaf_key
|
||||||
|
Loading…
Reference in New Issue
Block a user