feat(wallet): detect ETH L1 to L2 bridge transactions
This commit is contained in:
parent
fb6e2a41f7
commit
e6711c8cc8
|
@ -76,6 +76,7 @@
|
|||
// 1687269871_add_device_name.up.sql (108B)
|
||||
// 1687506642_include_watch_only_account_setting.up.sql (81B)
|
||||
// 1688022264_add_include_watch_only_account_to_settings_sync_clock.up.sql (98B)
|
||||
// 1688054680_add_columns_to_multitransaction.up.sql (342B)
|
||||
// doc.go (74B)
|
||||
|
||||
package migrations
|
||||
|
@ -159,7 +160,7 @@ func _1640111208_dummyUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1640111208_dummy.up.sql", size: 258, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1640111208_dummy.up.sql", size: 258, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3e, 0xf0, 0xae, 0x20, 0x6e, 0x75, 0xd1, 0x36, 0x14, 0xf2, 0x40, 0xe5, 0xd6, 0x7a, 0xc4, 0xa5, 0x72, 0xaa, 0xb5, 0x4d, 0x71, 0x97, 0xb8, 0xe8, 0x95, 0x22, 0x95, 0xa2, 0xac, 0xaf, 0x48, 0x58}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -179,7 +180,7 @@ func _1642666031_add_removed_clock_to_bookmarksUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1642666031_add_removed_clock_to_bookmarks.up.sql", size: 117, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1642666031_add_removed_clock_to_bookmarks.up.sql", size: 117, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x84, 0x4e, 0x38, 0x99, 0x7a, 0xc, 0x90, 0x13, 0xec, 0xfe, 0x2f, 0x55, 0xff, 0xb7, 0xb6, 0xaa, 0x96, 0xc6, 0x92, 0x79, 0xcc, 0xee, 0x4e, 0x99, 0x53, 0xfe, 0x1c, 0xbb, 0x32, 0x2, 0xa4, 0x27}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -199,7 +200,7 @@ func _1643644541_gif_api_key_settingUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1643644541_gif_api_key_setting.up.sql", size: 108, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1643644541_gif_api_key_setting.up.sql", size: 108, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1b, 0x94, 0x28, 0xfb, 0x66, 0xd1, 0x7c, 0xb8, 0x89, 0xe2, 0xb4, 0x71, 0x65, 0x24, 0x57, 0x22, 0x95, 0x38, 0x97, 0x3, 0x9b, 0xc6, 0xa4, 0x41, 0x7b, 0xba, 0xf7, 0xdb, 0x70, 0xf7, 0x20, 0x3a}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -219,7 +220,7 @@ func _1644188994_recent_stickersUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1644188994_recent_stickers.up.sql", size: 79, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1644188994_recent_stickers.up.sql", size: 79, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1e, 0xad, 0xaa, 0x30, 0xbf, 0x4, 0x7, 0xf8, 0xc3, 0x3, 0xb8, 0x97, 0x23, 0x2b, 0xbd, 0x1c, 0x60, 0x69, 0xb0, 0x42, 0x5e, 0x6b, 0xd, 0xa7, 0xa3, 0x6b, 0x2e, 0xdc, 0x70, 0x13, 0x72, 0x7}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -239,7 +240,7 @@ func _1646659233_add_address_to_dapp_permisssionUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1646659233_add_address_to_dapp_permisssion.up.sql", size: 700, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1646659233_add_address_to_dapp_permisssion.up.sql", size: 700, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xed, 0xb0, 0x35, 0xcc, 0x2e, 0x16, 0xe6, 0x15, 0x86, 0x2c, 0x37, 0x80, 0xae, 0xa3, 0xc5, 0x31, 0x78, 0x5, 0x9d, 0xcd, 0x7b, 0xeb, 0x5f, 0xf2, 0xb3, 0x74, 0x72, 0xdf, 0xcf, 0x88, 0xb, 0x40}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -259,7 +260,7 @@ func _1646841105_add_emoji_accountUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1646841105_add_emoji_account.up.sql", size: 96, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1646841105_add_emoji_account.up.sql", size: 96, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe6, 0x77, 0x29, 0x95, 0x18, 0x64, 0x82, 0x63, 0xe7, 0xaf, 0x6c, 0xa9, 0x15, 0x7d, 0x46, 0xa6, 0xbc, 0xdf, 0xa7, 0xd, 0x2b, 0xd2, 0x2d, 0x97, 0x4d, 0xa, 0x6b, 0xd, 0x6e, 0x90, 0x42, 0x5c}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -279,7 +280,7 @@ func _1647278782_display_nameUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1647278782_display_name.up.sql", size: 110, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1647278782_display_name.up.sql", size: 110, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf4, 0xa1, 0x1f, 0x3e, 0x61, 0x65, 0x8d, 0xff, 0xee, 0xde, 0xc5, 0x91, 0xd9, 0x5c, 0xb5, 0xe2, 0xf0, 0xb7, 0xe7, 0x5c, 0x5c, 0x16, 0x25, 0x89, 0xee, 0x78, 0x12, 0xea, 0x3e, 0x48, 0x41, 0xa6}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -299,7 +300,7 @@ func _1647862838_reset_last_backupUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1647862838_reset_last_backup.up.sql", size: 37, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1647862838_reset_last_backup.up.sql", size: 37, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x21, 0xe3, 0xd5, 0xf6, 0x5f, 0xfe, 0x65, 0xfa, 0x1d, 0x88, 0xf8, 0x5f, 0x24, 0x71, 0x34, 0x68, 0x96, 0x2a, 0x60, 0x87, 0x15, 0x82, 0x4d, 0x8a, 0x59, 0x3d, 0x1f, 0xd8, 0x56, 0xd4, 0xfb, 0xda}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -319,7 +320,7 @@ func _1647871652_add_settings_sync_clock_tableUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1647871652_add_settings_sync_clock_table.up.sql", size: 1044, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1647871652_add_settings_sync_clock_table.up.sql", size: 1044, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd8, 0x58, 0xec, 0x85, 0x90, 0xfa, 0x30, 0x98, 0x98, 0x9a, 0xa6, 0xa8, 0x96, 0x2b, 0x38, 0x93, 0xf3, 0xae, 0x46, 0x74, 0xa4, 0x41, 0x62, 0x9b, 0x2, 0x86, 0xbf, 0xe5, 0x2a, 0xce, 0xe2, 0xc0}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -339,7 +340,7 @@ func _1647880168_add_torrent_configUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1647880168_add_torrent_config.up.sql", size: 211, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1647880168_add_torrent_config.up.sql", size: 211, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1, 0x92, 0x22, 0x37, 0x96, 0xf3, 0xb5, 0x5b, 0x27, 0xd0, 0x7d, 0x43, 0x5, 0x4e, 0x9d, 0xe2, 0x49, 0xbe, 0x86, 0x31, 0xa1, 0x89, 0xff, 0xd6, 0x51, 0xe0, 0x9c, 0xb, 0xda, 0xfc, 0xf2, 0x93}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -359,7 +360,7 @@ func _1647882837_add_communities_settings_tableUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1647882837_add_communities_settings_table.up.sql", size: 206, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1647882837_add_communities_settings_table.up.sql", size: 206, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xbd, 0x87, 0x78, 0x99, 0xd9, 0x5d, 0xbd, 0xf7, 0x57, 0x9c, 0xca, 0x97, 0xbd, 0xb3, 0xe9, 0xb5, 0x89, 0x31, 0x3f, 0xf6, 0x5c, 0x13, 0xb, 0xc3, 0x54, 0x93, 0x18, 0x40, 0x7, 0x82, 0xfe, 0x7e}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -379,7 +380,7 @@ func _1647956635_add_waku_messages_tableUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1647956635_add_waku_messages_table.up.sql", size: 266, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1647956635_add_waku_messages_table.up.sql", size: 266, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd1, 0xe, 0xe1, 0xdc, 0xda, 0x2e, 0x89, 0x8d, 0xdc, 0x2a, 0x1c, 0x13, 0xa1, 0xfc, 0xfe, 0xf, 0xb2, 0xb9, 0x85, 0xc8, 0x45, 0xd6, 0xd1, 0x7, 0x5c, 0xa3, 0x8, 0x47, 0x44, 0x6d, 0x96, 0xe0}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -399,7 +400,7 @@ func _1648554928_network_testUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1648554928_network_test.up.sql", size: 132, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1648554928_network_test.up.sql", size: 132, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9a, 0xc5, 0x7f, 0x87, 0xf3, 0x2c, 0xf7, 0xbb, 0xd3, 0x3a, 0x4e, 0x76, 0x88, 0xca, 0xaf, 0x73, 0xce, 0x8f, 0xa1, 0xf6, 0x3d, 0x4d, 0xed, 0x6f, 0x49, 0xf2, 0xfe, 0x56, 0x2a, 0x60, 0x68, 0xca}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -419,7 +420,7 @@ func _1649174829_add_visitble_tokenUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1649174829_add_visitble_token.up.sql", size: 84, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1649174829_add_visitble_token.up.sql", size: 84, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa3, 0x22, 0xc0, 0x2b, 0x3f, 0x4f, 0x3d, 0x5e, 0x4c, 0x68, 0x7c, 0xd0, 0x15, 0x36, 0x9f, 0xec, 0xa1, 0x2a, 0x7b, 0xb4, 0xe3, 0xc6, 0xc9, 0xb4, 0x81, 0x50, 0x4a, 0x11, 0x3b, 0x35, 0x7, 0xcf}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -439,7 +440,7 @@ func _1649882262_add_derived_from_accountsUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1649882262_add_derived_from_accounts.up.sql", size: 110, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1649882262_add_derived_from_accounts.up.sql", size: 110, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x11, 0xb9, 0x44, 0x4d, 0x85, 0x8d, 0x7f, 0xb4, 0xae, 0x4f, 0x5c, 0x66, 0x64, 0xb6, 0xe2, 0xe, 0x3d, 0xad, 0x9d, 0x8, 0x4f, 0xab, 0x6e, 0xa8, 0x7d, 0x76, 0x3, 0xad, 0x96, 0x1, 0xee, 0x5c}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -459,7 +460,7 @@ func _1650612625_add_community_message_archive_hashes_tableUpSql() (*asset, erro
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1650612625_add_community_message_archive_hashes_table.up.sql", size: 130, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1650612625_add_community_message_archive_hashes_table.up.sql", size: 130, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x48, 0x31, 0xb3, 0x75, 0x23, 0xe2, 0x45, 0xe, 0x47, 0x1b, 0x35, 0xa5, 0x6e, 0x83, 0x4e, 0x64, 0x7d, 0xd7, 0xa2, 0xda, 0xe9, 0x53, 0xf1, 0x16, 0x86, 0x2c, 0x57, 0xad, 0xfa, 0xca, 0x39, 0xde}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -479,7 +480,7 @@ func _1650616788_add_communities_archives_info_tableUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1650616788_add_communities_archives_info_table.up.sql", size: 208, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1650616788_add_communities_archives_info_table.up.sql", size: 208, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd1, 0x4f, 0x80, 0x45, 0xb9, 0xd9, 0x15, 0xe2, 0x78, 0xd0, 0xcb, 0x71, 0xc1, 0x1b, 0xb7, 0x1b, 0x1b, 0x97, 0xfe, 0x47, 0x53, 0x3c, 0x62, 0xbc, 0xdd, 0x3a, 0x94, 0x1a, 0xc, 0x48, 0x76, 0xe}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -499,7 +500,7 @@ func _1652715604_add_clock_accountsUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1652715604_add_clock_accounts.up.sql", size: 62, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1652715604_add_clock_accounts.up.sql", size: 62, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb6, 0xd9, 0x8d, 0x73, 0xc9, 0xef, 0xfa, 0xb1, 0x4b, 0xa5, 0xf3, 0x5, 0x19, 0x26, 0x46, 0xf8, 0x47, 0x93, 0xdb, 0xac, 0x2, 0xef, 0xf9, 0x71, 0x56, 0x83, 0xe6, 0x2d, 0xb0, 0xd7, 0x83, 0x5c}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -519,7 +520,7 @@ func _1653037334_add_notifications_settings_tableUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1653037334_add_notifications_settings_table.up.sql", size: 1276, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1653037334_add_notifications_settings_table.up.sql", size: 1276, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x4b, 0xc4, 0x65, 0xac, 0xa, 0xf2, 0xef, 0xb6, 0x39, 0x3c, 0xc5, 0xb1, 0xb2, 0x9c, 0x86, 0x58, 0xe0, 0x38, 0xcb, 0x57, 0x3c, 0x76, 0x73, 0x87, 0x79, 0x4e, 0xf6, 0xed, 0xb0, 0x8e, 0x9e, 0xa}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -539,7 +540,7 @@ func _1654702119_add_mutual_contact_settingsUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1654702119_add_mutual_contact_settings.up.sql", size: 78, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1654702119_add_mutual_contact_settings.up.sql", size: 78, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x26, 0x66, 0x67, 0x50, 0xfe, 0xd7, 0xe3, 0x29, 0x8b, 0xff, 0x9d, 0x5a, 0x87, 0xa7, 0x99, 0x6e, 0xd6, 0xcd, 0x2e, 0xbb, 0x17, 0xdf, 0x7f, 0xf7, 0xa3, 0xfa, 0x32, 0x7c, 0x2d, 0x92, 0xc8, 0x74}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -559,7 +560,7 @@ func _1655375270_add_clock_field_to_communities_settings_tableUpSql() (*asset, e
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1655375270_add_clock_field_to_communities_settings_table.up.sql", size: 74, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1655375270_add_clock_field_to_communities_settings_table.up.sql", size: 74, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x19, 0xc5, 0xc0, 0xf9, 0x84, 0x53, 0xdf, 0x83, 0xcf, 0xb6, 0x40, 0x6d, 0xf5, 0xdc, 0x77, 0x37, 0xb7, 0xe3, 0xa, 0x75, 0xe7, 0x6, 0x11, 0xca, 0x2b, 0x51, 0x92, 0xdd, 0x7d, 0xdb, 0xc3, 0xf5}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -579,7 +580,7 @@ func _1655385721_drop_networks_configUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1655385721_drop_networks_config.up.sql", size: 27, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1655385721_drop_networks_config.up.sql", size: 27, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xfc, 0xa7, 0x20, 0xbb, 0x67, 0x21, 0xe, 0xc6, 0xc8, 0x21, 0x74, 0xe0, 0xce, 0xc8, 0xe2, 0x2, 0xb4, 0xea, 0xf0, 0xe5, 0xc4, 0x4d, 0xdd, 0xd4, 0x52, 0x31, 0xa9, 0x3d, 0xcd, 0xd8, 0x9b, 0xab}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -599,7 +600,7 @@ func _1655385724_networks_chaincolor_shortnameUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1655385724_networks_chainColor_shortName.up.sql", size: 220, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1655385724_networks_chainColor_shortName.up.sql", size: 220, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd9, 0xe7, 0x84, 0xbb, 0x5f, 0xd2, 0x2c, 0x42, 0x88, 0x62, 0x52, 0xb6, 0x58, 0x31, 0xac, 0xc, 0x96, 0x2b, 0x1b, 0xe5, 0x4e, 0x9a, 0x3a, 0xf6, 0xf6, 0xfc, 0xa9, 0x1a, 0x35, 0x62, 0x28, 0x88}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -619,7 +620,7 @@ func _1655456688_add_deleted_at_field_to_bookmarks_tableUpSql() (*asset, error)
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1655456688_add_deleted_at_field_to_bookmarks_table.up.sql", size: 69, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1655456688_add_deleted_at_field_to_bookmarks_table.up.sql", size: 69, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe7, 0x9a, 0xbd, 0x9a, 0xc9, 0xf, 0xdf, 0x90, 0x0, 0x5d, 0xea, 0x6e, 0x7d, 0x51, 0x95, 0xcd, 0x90, 0xd3, 0x1a, 0x36, 0x6c, 0xf4, 0xbd, 0xa7, 0x6b, 0xbf, 0xe5, 0xdb, 0xa3, 0x88, 0xe3, 0x50}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -639,7 +640,7 @@ func _1655462032_create_bookmarks_deleted_at_indexUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1655462032_create_bookmarks_deleted_at_index.up.sql", size: 81, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1655462032_create_bookmarks_deleted_at_index.up.sql", size: 81, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf, 0x8e, 0x20, 0x6b, 0x14, 0x9e, 0xcd, 0x97, 0xd3, 0xfe, 0x62, 0x3, 0x26, 0x59, 0x1, 0x6c, 0x99, 0xef, 0x6d, 0x21, 0xd4, 0xb5, 0xa3, 0xf4, 0x39, 0x40, 0x54, 0x6, 0xd, 0x60, 0x13, 0x38}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -659,7 +660,7 @@ func _1657617291_add_multi_transactions_tableUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1657617291_add_multi_transactions_table.up.sql", size: 412, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1657617291_add_multi_transactions_table.up.sql", size: 412, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x86, 0xb0, 0x4e, 0x8c, 0x4, 0x82, 0xb4, 0x43, 0xaa, 0xd0, 0x16, 0xdd, 0xcb, 0x88, 0x81, 0xac, 0x4, 0x34, 0x1a, 0x8f, 0x2e, 0xc5, 0x69, 0xb, 0xf0, 0x17, 0xf7, 0xe3, 0x9, 0xe, 0x54, 0xe0}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -679,7 +680,7 @@ func _1660134042_add_social_links_settings_tableUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1660134042_add_social_links_settings_table.up.sql", size: 334, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1660134042_add_social_links_settings_table.up.sql", size: 334, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x84, 0x73, 0xb6, 0xe7, 0x3f, 0xaa, 0x39, 0x9a, 0x56, 0x56, 0x31, 0xf1, 0x8e, 0x26, 0x23, 0x1, 0xe4, 0xfa, 0x98, 0xfe, 0x78, 0x87, 0x20, 0xcb, 0x52, 0xf4, 0x38, 0x7f, 0xc4, 0x1c, 0x4, 0x22}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -699,7 +700,7 @@ func _1660134060_settings_bioUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1660134060_settings_bio.up.sql", size: 91, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1660134060_settings_bio.up.sql", size: 91, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x46, 0x25, 0xa0, 0xa6, 0x47, 0xff, 0xbc, 0x2a, 0x0, 0xff, 0x59, 0x4b, 0xb0, 0xc9, 0x4e, 0x15, 0xe4, 0xd9, 0xda, 0xeb, 0xfe, 0x55, 0x98, 0xc3, 0x9d, 0x96, 0xe7, 0xf, 0xd1, 0x5c, 0x93, 0x73}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -719,7 +720,7 @@ func _1660134070_add_wakuv2_storeUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1660134070_add_wakuv2_store.up.sql", size: 269, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1660134070_add_wakuv2_store.up.sql", size: 269, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1d, 0xe6, 0xc3, 0x9, 0xef, 0xdc, 0xae, 0x49, 0x30, 0x78, 0x54, 0xd6, 0xdb, 0xbf, 0xc0, 0x8e, 0x25, 0x8f, 0xfc, 0x67, 0x80, 0x39, 0x37, 0xd4, 0x86, 0xc1, 0x85, 0xc8, 0x99, 0xc4, 0x59, 0xd4}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -739,7 +740,7 @@ func _1660134072_waku2_store_messagesUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1660134072_waku2_store_messages.up.sql", size: 497, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1660134072_waku2_store_messages.up.sql", size: 497, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3e, 0xeb, 0xb4, 0xa0, 0xa1, 0x2b, 0xcb, 0x4c, 0x3c, 0xc6, 0xd0, 0xe8, 0x96, 0xe3, 0x96, 0xf1, 0x4f, 0x1f, 0xe0, 0xe7, 0x1f, 0x85, 0xa3, 0xe, 0xf7, 0x52, 0x56, 0x63, 0x2b, 0xb0, 0x87, 0x7b}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -759,7 +760,7 @@ func _1662365868_add_key_uid_accountsUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1662365868_add_key_uid_accounts.up.sql", size: 68, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1662365868_add_key_uid_accounts.up.sql", size: 68, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xc6, 0xd8, 0x2f, 0x2f, 0x3b, 0xa8, 0xbd, 0x6d, 0xf6, 0x87, 0x7e, 0xd2, 0xf1, 0xa2, 0xf7, 0x81, 0x6a, 0x23, 0x10, 0xbc, 0xbf, 0x5b, 0xe7, 0x2b, 0x9c, 0xa9, 0x8a, 0x18, 0xbb, 0xd0, 0x86, 0x91}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -779,7 +780,7 @@ func _1662447680_add_keypairs_tableUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1662447680_add_keypairs_table.up.sql", size: 218, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1662447680_add_keypairs_table.up.sql", size: 218, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xdc, 0x25, 0xa9, 0xc7, 0x63, 0x27, 0x97, 0x35, 0x5f, 0x6b, 0xab, 0x26, 0xcb, 0xf9, 0xbd, 0x5e, 0xac, 0x3, 0xa0, 0x5e, 0xb9, 0x71, 0xa3, 0x1f, 0xb3, 0x4f, 0x7f, 0x79, 0x28, 0x48, 0xbe, 0xc}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -799,7 +800,7 @@ func _1662460056_move_favourites_to_saved_addressesUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1662460056_move_favourites_to_saved_addresses.up.sql", size: 233, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1662460056_move_favourites_to_saved_addresses.up.sql", size: 233, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x10, 0xa2, 0x8c, 0xa3, 0xec, 0xad, 0xdf, 0xc3, 0x48, 0x5, 0x9b, 0x50, 0x25, 0x59, 0xae, 0x7d, 0xee, 0x58, 0xd2, 0x41, 0x27, 0xf2, 0x22, 0x2e, 0x9a, 0xb9, 0x4a, 0xcc, 0x38, 0x6e, 0x3a, 0xb2}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -819,7 +820,7 @@ func _1662738097_add_base_fee_transactionUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1662738097_add_base_fee_transaction.up.sql", size: 112, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1662738097_add_base_fee_transaction.up.sql", size: 112, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6b, 0xfb, 0x10, 0xae, 0xfc, 0x77, 0x70, 0x98, 0x6f, 0xec, 0xaa, 0xcd, 0x7, 0xc7, 0x74, 0x23, 0xc, 0xd5, 0x1e, 0x82, 0xdd, 0xfe, 0xff, 0x3b, 0xd2, 0x49, 0x10, 0x5b, 0x30, 0xc, 0x2d, 0xb0}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -839,7 +840,7 @@ func _1662972194_add_keypairs_tableUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1662972194_add_keypairs_table.up.sql", size: 345, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1662972194_add_keypairs_table.up.sql", size: 345, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xab, 0x76, 0xf2, 0x86, 0xe1, 0x7e, 0xe9, 0x47, 0x32, 0x48, 0xd5, 0x6b, 0xe5, 0xd, 0xab, 0xb7, 0xf1, 0xd4, 0xf1, 0xad, 0x38, 0xa6, 0x11, 0xe7, 0xce, 0x5c, 0x11, 0x11, 0xf, 0x47, 0xb2, 0x4}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -859,7 +860,7 @@ func _1664392661_add_third_party_id_to_waku_messagesUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1664392661_add_third_party_id_to_waku_messages.up.sql", size: 70, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1664392661_add_third_party_id_to_waku_messages.up.sql", size: 70, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xfd, 0x67, 0x66, 0x9e, 0x66, 0x74, 0xce, 0x1c, 0xb, 0x1b, 0x9d, 0xd5, 0xfc, 0x65, 0xe, 0x83, 0x90, 0x4c, 0x61, 0x4e, 0x6b, 0xe7, 0x86, 0xbe, 0x36, 0x4f, 0x91, 0x36, 0x4, 0x47, 0x7b, 0x82}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -879,7 +880,7 @@ func _1664783660_add_sync_info_to_saved_addressesUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1664783660_add_sync_info_to_saved_addresses.up.sql", size: 388, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1664783660_add_sync_info_to_saved_addresses.up.sql", size: 388, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x67, 0x7c, 0x3a, 0x95, 0x4e, 0x55, 0xb2, 0xbd, 0xb4, 0x18, 0x93, 0xc1, 0xcf, 0x9f, 0x12, 0xbb, 0x49, 0x8a, 0x2a, 0x6a, 0x2a, 0x7f, 0xad, 0x44, 0xc3, 0xf, 0x3a, 0x79, 0x18, 0xb9, 0x4c, 0x64}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -899,7 +900,7 @@ func _1668109917_wakunodesUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1668109917_wakunodes.up.sql", size: 99, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1668109917_wakunodes.up.sql", size: 99, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x29, 0xaa, 0x9e, 0x2, 0x66, 0x85, 0x69, 0xa8, 0xd9, 0xe2, 0x4b, 0x8d, 0x2a, 0x9c, 0xdf, 0xd2, 0xef, 0x64, 0x58, 0xe3, 0xa6, 0xe7, 0xc1, 0xd1, 0xc8, 0x9c, 0xc0, 0x2c, 0x1, 0xa8, 0x7b, 0x81}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -919,7 +920,7 @@ func _1670249678_display_name_to_settings_sync_clock_tableUpSql() (*asset, error
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1670249678_display_name_to_settings_sync_clock_table.up.sql", size: 83, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1670249678_display_name_to_settings_sync_clock_table.up.sql", size: 83, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x39, 0x18, 0xdc, 0xc4, 0x1f, 0x79, 0x22, 0x16, 0x4d, 0xdf, 0x6c, 0x66, 0xd5, 0xa4, 0x88, 0x5d, 0x5, 0x37, 0xa7, 0x41, 0x5, 0x50, 0xae, 0x12, 0xfa, 0x7e, 0x89, 0x24, 0x5c, 0xae, 0x30, 0xfc}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -939,7 +940,7 @@ func _1670836810_add_imported_flag_to_community_archive_hashesUpSql() (*asset, e
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1670836810_add_imported_flag_to_community_archive_hashes.up.sql", size: 144, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1670836810_add_imported_flag_to_community_archive_hashes.up.sql", size: 144, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6f, 0xf, 0xf0, 0xbd, 0xfe, 0x63, 0x25, 0x8f, 0x5e, 0x46, 0x4b, 0x45, 0x31, 0x8b, 0x3e, 0xd8, 0x6b, 0x5d, 0x9d, 0x6d, 0x10, 0x9a, 0x87, 0x4b, 0x18, 0xc6, 0x39, 0x81, 0x6e, 0xe4, 0x75, 0xfb}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -959,7 +960,7 @@ func _1671438731_add_magnetlink_uri_to_communities_archive_infoUpSql() (*asset,
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1671438731_add_magnetlink_uri_to_communities_archive_info.up.sql", size: 86, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1671438731_add_magnetlink_uri_to_communities_archive_info.up.sql", size: 86, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xda, 0x8b, 0x4b, 0xd6, 0xd8, 0xe2, 0x3d, 0xf7, 0x6b, 0xcd, 0x1e, 0x70, 0x9, 0x2e, 0x35, 0x4, 0x61, 0xc3, 0xb5, 0x9d, 0xc5, 0x27, 0x21, 0xa, 0x5a, 0xd6, 0x3e, 0xa6, 0x24, 0xa2, 0x12, 0xdf}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -979,7 +980,7 @@ func _1672933930_switcher_cardUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1672933930_switcher_card.up.sql", size: 162, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1672933930_switcher_card.up.sql", size: 162, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x39, 0xba, 0xdc, 0xbb, 0x40, 0x4, 0xf2, 0x10, 0xdf, 0xb4, 0xd2, 0x80, 0x8a, 0x74, 0x4d, 0xf6, 0xbc, 0x50, 0x7, 0xd, 0x22, 0x7f, 0xc4, 0xaf, 0xaa, 0xde, 0xdc, 0x71, 0xe9, 0x42, 0x98, 0x36}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -999,7 +1000,7 @@ func _1674056187_add_price_cacheUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1674056187_add_price_cache.up.sql", size: 255, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1674056187_add_price_cache.up.sql", size: 255, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb7, 0x79, 0x6a, 0x9b, 0x28, 0xd1, 0x22, 0xf0, 0x84, 0x76, 0x40, 0x39, 0x49, 0x15, 0x5d, 0xaa, 0xfd, 0x11, 0xff, 0x13, 0x27, 0x42, 0x12, 0xfa, 0x82, 0xe6, 0x7a, 0xf0, 0x5e, 0x1f, 0xe3, 0xba}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1019,7 +1020,7 @@ func _1674136690_ens_usernamesUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1674136690_ens_usernames.up.sql", size: 98, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1674136690_ens_usernames.up.sql", size: 98, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x81, 0x7a, 0xf3, 0xa8, 0x88, 0x99, 0xd6, 0x9c, 0x69, 0x48, 0x3c, 0x10, 0xda, 0x72, 0xdc, 0x14, 0xd, 0x6e, 0x8c, 0x82, 0x92, 0x2d, 0x2c, 0xee, 0x4c, 0x70, 0xa4, 0xdc, 0x5c, 0x5, 0x2, 0xc3}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1039,7 +1040,7 @@ func _1674232431_add_balance_historyUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1674232431_add_balance_history.up.sql", size: 698, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1674232431_add_balance_history.up.sql", size: 698, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf7, 0xb5, 0x18, 0xca, 0x4a, 0x93, 0xbb, 0x6f, 0xa4, 0xee, 0xe4, 0x3e, 0xff, 0x6a, 0x4b, 0xe2, 0xe1, 0x61, 0x28, 0xee, 0xc5, 0x26, 0x57, 0x61, 0x5e, 0x6d, 0x44, 0x1e, 0x85, 0x43, 0x70, 0xa2}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1059,7 +1060,7 @@ func _1676368933_keypairs_to_keycardsUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1676368933_keypairs_to_keycards.up.sql", size: 639, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1676368933_keypairs_to_keycards.up.sql", size: 639, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x81, 0x93, 0x27, 0x2, 0xf0, 0x37, 0x81, 0x65, 0xa4, 0xb3, 0x5b, 0x60, 0x36, 0x95, 0xfc, 0x81, 0xf0, 0x3b, 0x7c, 0xc3, 0x2c, 0x85, 0xbd, 0x38, 0x46, 0xa4, 0x95, 0x4a, 0x6, 0x3e, 0x74, 0xd5}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1079,7 +1080,7 @@ func _1676951398_add_currency_format_cacheUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1676951398_add_currency_format_cache.up.sql", size: 291, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1676951398_add_currency_format_cache.up.sql", size: 291, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf9, 0xa3, 0x76, 0x35, 0xca, 0xf, 0xe8, 0xdf, 0xd9, 0x61, 0xf9, 0xed, 0xfc, 0x6d, 0xf5, 0xe, 0x11, 0x88, 0xbd, 0x14, 0x92, 0xc6, 0x57, 0x53, 0xe, 0xcd, 0x52, 0xf4, 0xa9, 0xb1, 0xdd, 0xfd}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1099,7 +1100,7 @@ func _1676968196_keycards_add_clock_columnUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1676968196_keycards_add_clock_column.up.sql", size: 73, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1676968196_keycards_add_clock_column.up.sql", size: 73, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x4c, 0xf, 0x1c, 0x28, 0x41, 0x57, 0x57, 0x6c, 0xe, 0x75, 0x6b, 0x75, 0x12, 0x0, 0x18, 0x1e, 0x88, 0x1e, 0x45, 0xe0, 0x32, 0xb9, 0xd4, 0xd9, 0x2e, 0xc8, 0xb, 0x80, 0x6, 0x51, 0x3d, 0x28}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1119,7 +1120,7 @@ func _1676968197_add_fallback_rpc_to_networksUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1676968197_add_fallback_rpc_to_networks.up.sql", size: 112, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1676968197_add_fallback_rpc_to_networks.up.sql", size: 112, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x77, 0x6a, 0xc6, 0x45, 0xfa, 0x62, 0x84, 0x74, 0x6d, 0x7c, 0xd7, 0x1d, 0x79, 0xb6, 0x38, 0x43, 0xa8, 0x8, 0x6b, 0x75, 0x3d, 0x9, 0x2, 0xc5, 0x9f, 0xbb, 0x45, 0x56, 0x4c, 0x4e, 0x17, 0x89}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1139,7 +1140,7 @@ func _1677674090_add_chains_ens_istest_to_saved_addressesUpSql() (*asset, error)
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1677674090_add_chains_ens_istest_to_saved_addresses.up.sql", size: 638, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1677674090_add_chains_ens_istest_to_saved_addresses.up.sql", size: 638, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa8, 0x2d, 0xa4, 0x1b, 0xf6, 0x6a, 0x13, 0x7b, 0xe, 0x59, 0xcd, 0xe2, 0x4e, 0x81, 0x99, 0xc4, 0x33, 0x84, 0xde, 0x66, 0xca, 0xac, 0x2f, 0x5, 0x90, 0xac, 0xfd, 0x4e, 0xfc, 0x55, 0x44, 0xe5}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1159,7 +1160,7 @@ func _1677681143_accounts_table_type_column_updateUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1677681143_accounts_table_type_column_update.up.sql", size: 135, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1677681143_accounts_table_type_column_update.up.sql", size: 135, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd2, 0xc4, 0x6, 0x42, 0x50, 0x1d, 0xf4, 0x48, 0x55, 0xbc, 0xa2, 0x19, 0xdd, 0xad, 0xc8, 0xc, 0xa7, 0x30, 0xb6, 0xaf, 0xe, 0x2b, 0xaa, 0x2a, 0xa4, 0xe1, 0xb9, 0x41, 0x23, 0x66, 0xd3, 0x3}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1179,7 +1180,7 @@ func _1678264207_accounts_table_new_columns_addedUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1678264207_accounts_table_new_columns_added.up.sql", size: 130, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1678264207_accounts_table_new_columns_added.up.sql", size: 130, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf4, 0xd4, 0xf3, 0x35, 0xef, 0x5c, 0x19, 0x3c, 0x15, 0x90, 0x60, 0xbd, 0x1f, 0x81, 0xf0, 0x86, 0x73, 0x89, 0xa0, 0x70, 0xf2, 0x46, 0xae, 0xea, 0xd0, 0xc6, 0x9e, 0x55, 0x4a, 0x54, 0x62, 0xbb}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1199,7 +1200,7 @@ func _1680770368_add_bio_to_settings_sync_clock_tableUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1680770368_add_bio_to_settings_sync_clock_table.up.sql", size: 75, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1680770368_add_bio_to_settings_sync_clock_table.up.sql", size: 75, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x4a, 0x52, 0xf6, 0x3f, 0xaa, 0xd, 0xa0, 0xee, 0xe8, 0xe6, 0x16, 0x21, 0x80, 0x61, 0xe4, 0x7a, 0x4e, 0x37, 0x8d, 0x30, 0x51, 0x20, 0x4d, 0x15, 0x47, 0xfb, 0x6, 0xa1, 0xce, 0xc8, 0x27, 0x5a}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1219,7 +1220,7 @@ func _1681110436_add_mnemonic_to_settings_sync_clock_tableUpSql() (*asset, error
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1681110436_add_mnemonic_to_settings_sync_clock_table.up.sql", size: 311, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1681110436_add_mnemonic_to_settings_sync_clock_table.up.sql", size: 311, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3d, 0x74, 0x81, 0x7d, 0x9e, 0x77, 0xb6, 0xfe, 0xe3, 0xcb, 0x48, 0xe5, 0x5f, 0x39, 0x23, 0xa1, 0x7d, 0x53, 0x22, 0xe8, 0x96, 0x15, 0x8a, 0x1e, 0x8e, 0xbc, 0xe2, 0x1d, 0xc4, 0xc2, 0x56, 0x34}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1239,7 +1240,7 @@ func _1681392602_9d_sync_periodUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1681392602_9d_sync_period.up.sql", size: 60, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1681392602_9d_sync_period.up.sql", size: 60, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xc9, 0xa, 0x90, 0x29, 0x7f, 0x76, 0x98, 0xa7, 0x71, 0x80, 0x5a, 0x2f, 0xbe, 0x23, 0x9a, 0xd4, 0xf4, 0x39, 0x19, 0xd3, 0xa5, 0x34, 0x6e, 0x67, 0x6a, 0xbe, 0x8a, 0xad, 0x21, 0xc7, 0xba, 0x88}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1259,7 +1260,7 @@ func _1681762078_default_sync_period_9dUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1681762078_default_sync_period_9d.up.sql", size: 3002, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1681762078_default_sync_period_9d.up.sql", size: 3002, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3e, 0xd9, 0x26, 0xfc, 0xa9, 0x45, 0xc1, 0x81, 0xa8, 0xe2, 0x2c, 0xe9, 0x3c, 0xea, 0x1d, 0x37, 0x11, 0x45, 0x8c, 0x6c, 0xbc, 0xc2, 0x6, 0x69, 0x2, 0x75, 0x29, 0x40, 0x9f, 0xc5, 0xbb, 0x36}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1279,7 +1280,7 @@ func _1681780680_add_clock_to_social_links_settingsUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1681780680_add_clock_to_social_links_settings.up.sql", size: 137, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1681780680_add_clock_to_social_links_settings.up.sql", size: 137, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x63, 0x11, 0xf5, 0x41, 0xe5, 0x5a, 0xf4, 0xe3, 0xf3, 0x14, 0x87, 0x28, 0xd8, 0xf0, 0x52, 0x31, 0x8, 0xd5, 0xbb, 0xf4, 0xff, 0x55, 0x5f, 0x42, 0x90, 0xcb, 0xf7, 0x46, 0x2, 0x6, 0xbe, 0x42}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1299,7 +1300,7 @@ func _1682073779_settings_table_remove_latest_derived_path_columnUpSql() (*asset
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1682073779_settings_table_remove_latest_derived_path_column.up.sql", size: 4470, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1682073779_settings_table_remove_latest_derived_path_column.up.sql", size: 4470, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x7a, 0x36, 0x2, 0x41, 0xd, 0x5c, 0xd1, 0x92, 0x85, 0x6d, 0x84, 0xff, 0x67, 0xa7, 0x4c, 0x67, 0xa4, 0xef, 0x52, 0x69, 0x1f, 0x22, 0x25, 0x92, 0xc, 0xb3, 0x89, 0x50, 0x91, 0xc, 0x49, 0xf9}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1319,7 +1320,7 @@ func _1682146075_add_created_at_to_saved_addressesUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1682146075_add_created_at_to_saved_addresses.up.sql", size: 107, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1682146075_add_created_at_to_saved_addresses.up.sql", size: 107, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x88, 0xfe, 0x35, 0x9c, 0x6b, 0xdf, 0x67, 0x18, 0x16, 0xe4, 0xc9, 0xd4, 0x77, 0x7c, 0x4, 0xe2, 0x6c, 0x41, 0xd9, 0x53, 0x97, 0xfe, 0x5, 0xa3, 0x23, 0xce, 0x82, 0xad, 0x92, 0x5e, 0xd7, 0x7d}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1339,7 +1340,7 @@ func _1682393575_sync_ens_nameUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1682393575_sync_ens_name.up.sql", size: 713, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1682393575_sync_ens_name.up.sql", size: 713, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xfb, 0xea, 0xcb, 0x4d, 0x71, 0x5a, 0x49, 0x19, 0x8b, 0xef, 0x66, 0x27, 0x33, 0x89, 0xb0, 0xe, 0x37, 0x1b, 0x41, 0x8, 0x12, 0xcc, 0x56, 0xd8, 0x1b, 0xf, 0xf8, 0x50, 0x4b, 0x93, 0xf1, 0x29}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1359,7 +1360,7 @@ func _1683457503_add_blocks_ranges_sequential_tableUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1683457503_add_blocks_ranges_sequential_table.up.sql", size: 263, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1683457503_add_blocks_ranges_sequential_table.up.sql", size: 263, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xfe, 0x57, 0x2e, 0x0, 0x6a, 0x6e, 0xd7, 0xeb, 0xe6, 0x66, 0x79, 0x32, 0x22, 0x82, 0x92, 0xf4, 0xc9, 0xf1, 0x58, 0x1a, 0x45, 0x60, 0x77, 0x50, 0xe7, 0x54, 0x4a, 0xc0, 0x42, 0x3a, 0x4f, 0x35}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1379,7 +1380,7 @@ func _1683627613_accounts_and_keycards_improvementsUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1683627613_accounts_and_keycards_improvements.up.sql", size: 3640, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1683627613_accounts_and_keycards_improvements.up.sql", size: 3640, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x8e, 0xbe, 0x62, 0xf5, 0x9, 0x42, 0x8c, 0x8f, 0xa8, 0x45, 0xe7, 0x36, 0xc9, 0xde, 0xf4, 0xe2, 0xfd, 0xc4, 0x8, 0xd0, 0xa3, 0x8, 0x64, 0xe2, 0x56, 0xcc, 0xa7, 0x6d, 0xc5, 0xcc, 0x82, 0x2c}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1399,7 +1400,7 @@ func _1685041348_settings_table_add_latest_derived_path_columnUpSql() (*asset, e
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1685041348_settings_table_add_latest_derived_path_column.up.sql", size: 115, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1685041348_settings_table_add_latest_derived_path_column.up.sql", size: 115, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x21, 0xd4, 0x1b, 0xbf, 0x8, 0xf9, 0xd4, 0xb0, 0xa0, 0x6, 0x5b, 0xfb, 0x7e, 0xff, 0xfa, 0xbf, 0xcc, 0x64, 0x47, 0x81, 0x8b, 0x5e, 0x17, 0x6a, 0xa7, 0xa4, 0x35, 0x8f, 0x30, 0x4f, 0xd9, 0xd}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1419,7 +1420,7 @@ func _1685440989_update_color_id_accountsUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1685440989_update_color_id_accounts.up.sql", size: 918, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1685440989_update_color_id_accounts.up.sql", size: 918, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x10, 0x2e, 0x51, 0x1d, 0x2d, 0x16, 0x84, 0xd6, 0xe8, 0xbc, 0x20, 0x53, 0x47, 0xb8, 0x40, 0x21, 0x52, 0x5c, 0xd9, 0xbb, 0xea, 0xe2, 0xa5, 0x77, 0xc8, 0x35, 0x4c, 0xe0, 0x9d, 0x42, 0x44, 0x50}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1439,7 +1440,7 @@ func _1685463947_add_to_asset_to_multitransactionUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1685463947_add_to_asset_to_multitransaction.up.sql", size: 61, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1685463947_add_to_asset_to_multitransaction.up.sql", size: 61, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd3, 0x66, 0x15, 0x10, 0xfa, 0x66, 0x81, 0x68, 0xd9, 0xb4, 0x93, 0x9e, 0x11, 0xed, 0x1d, 0x16, 0x9d, 0x5a, 0xf8, 0xd7, 0x8, 0xea, 0x7a, 0xaf, 0xe4, 0xb3, 0x22, 0x19, 0xca, 0xff, 0x75, 0x7c}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1459,7 +1460,7 @@ func _1685880973_add_profile_links_settings_tableUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1685880973_add_profile_links_settings_table.up.sql", size: 1656, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1685880973_add_profile_links_settings_table.up.sql", size: 1656, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x13, 0x23, 0x7b, 0x1e, 0x82, 0x61, 0xcc, 0x76, 0xd6, 0xc7, 0x42, 0x6e, 0x69, 0x21, 0x1b, 0xfd, 0x7d, 0xda, 0xd7, 0xb7, 0xc7, 0xd3, 0x22, 0x63, 0xfe, 0xc6, 0xd3, 0xdf, 0xc8, 0x5f, 0x50, 0xcc}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1479,7 +1480,7 @@ func _1686041510_add_idx_transfers_blkno_loadedUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1686041510_add_idx_transfers_blkno_loaded.up.sql", size: 71, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1686041510_add_idx_transfers_blkno_loaded.up.sql", size: 71, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe2, 0x5d, 0x7e, 0x43, 0x14, 0x3c, 0x50, 0x44, 0x25, 0xd0, 0xe1, 0x75, 0xba, 0x61, 0x7b, 0x68, 0x2e, 0x43, 0x74, 0x1d, 0x10, 0x61, 0x8e, 0x45, 0xe6, 0x25, 0x78, 0x81, 0x68, 0x6, 0x24, 0x5b}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1499,7 +1500,7 @@ func _1686048341_transfers_receipt_json_blob_outUpSqlDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1686048341_transfers_receipt_json_blob_out.up.sql.down.sql", size: 104, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1686048341_transfers_receipt_json_blob_out.up.sql.down.sql", size: 104, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9f, 0x6c, 0xd9, 0x76, 0x83, 0x64, 0xf0, 0xf2, 0x74, 0x97, 0xca, 0xd7, 0xaa, 0x4, 0x74, 0x7c, 0x34, 0x56, 0x88, 0x10, 0xa9, 0x4d, 0x1d, 0x8e, 0x85, 0xc3, 0x66, 0x1, 0x2b, 0x30, 0x90, 0xf4}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1519,7 +1520,7 @@ func _1686048341_transfers_receipt_json_blob_outUpSqlUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1686048341_transfers_receipt_json_blob_out.up.sql.up.sql", size: 1500, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1686048341_transfers_receipt_json_blob_out.up.sql.up.sql", size: 1500, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x49, 0xcd, 0xe3, 0xa6, 0x8c, 0x53, 0x51, 0xe6, 0x3c, 0x64, 0xcb, 0x3, 0x3, 0xb, 0x4d, 0x52, 0xa5, 0x1c, 0xcc, 0xe1, 0x23, 0x94, 0x14, 0x79, 0xd7, 0x56, 0x58, 0xef, 0xcc, 0x1a, 0x6, 0xa4}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1539,7 +1540,7 @@ func _1686825075_cleanup_token_addressUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1686825075_cleanup_token_address.up.sql", size: 273, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1686825075_cleanup_token_address.up.sql", size: 273, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x14, 0x72, 0x10, 0xec, 0x97, 0xc9, 0x3a, 0xdb, 0x39, 0x33, 0xc9, 0x6, 0x92, 0xbe, 0xe4, 0xc2, 0x5c, 0xb6, 0xaa, 0xe5, 0x25, 0x21, 0x4d, 0x74, 0x18, 0x94, 0xc, 0x33, 0x2f, 0xa4, 0x9, 0x99}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1559,7 +1560,7 @@ func _1687193315_transfers_extract_from_to_addressDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1687193315_transfers_extract_from_to_address.down.sql", size: 104, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1687193315_transfers_extract_from_to_address.down.sql", size: 104, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9f, 0x6c, 0xd9, 0x76, 0x83, 0x64, 0xf0, 0xf2, 0x74, 0x97, 0xca, 0xd7, 0xaa, 0x4, 0x74, 0x7c, 0x34, 0x56, 0x88, 0x10, 0xa9, 0x4d, 0x1d, 0x8e, 0x85, 0xc3, 0x66, 0x1, 0x2b, 0x30, 0x90, 0xf4}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1579,7 +1580,7 @@ func _1687193315_transfers_extract_from_to_addressUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1687193315_transfers_extract_from_to_address.up.sql", size: 499, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "1687193315_transfers_extract_from_to_address.up.sql", size: 499, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x4c, 0xef, 0xf4, 0x66, 0xac, 0x3a, 0xa6, 0xe3, 0x26, 0x43, 0x53, 0xe, 0xd8, 0xfe, 0xf2, 0xaa, 0x20, 0x8, 0x4e, 0x52, 0x49, 0x37, 0xbf, 0x46, 0xbf, 0x53, 0xa7, 0xcf, 0x27, 0x23, 0xab, 0x99}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1599,7 +1600,7 @@ func _1687249080_add_position_accountsUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1687249080_add_position_accounts.up..sql", size: 2053, mode: os.FileMode(0644), modTime: time.Unix(1688036173, 0)}
|
||||
info := bindataFileInfo{name: "1687249080_add_position_accounts.up..sql", size: 2053, mode: os.FileMode(0644), modTime: time.Unix(1688054623, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf3, 0x47, 0x9f, 0xb4, 0xe3, 0xc, 0x35, 0x15, 0x74, 0xc3, 0x72, 0x57, 0x9f, 0x3b, 0xc9, 0xd5, 0x9b, 0x31, 0xef, 0xd6, 0x21, 0xc4, 0x27, 0x8e, 0x37, 0xd5, 0x5, 0xdb, 0x3d, 0xcf, 0x37, 0xbb}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1619,7 +1620,7 @@ func _1687269871_add_device_nameUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1687269871_add_device_name.up.sql", size: 108, mode: os.FileMode(0644), modTime: time.Unix(1688027346, 0)}
|
||||
info := bindataFileInfo{name: "1687269871_add_device_name.up.sql", size: 108, mode: os.FileMode(0644), modTime: time.Unix(1688054623, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xed, 0x61, 0xf2, 0xf9, 0x78, 0x57, 0xc3, 0x57, 0xdb, 0x37, 0xe, 0x7, 0x15, 0xde, 0x5a, 0x2a, 0xb5, 0x86, 0xb8, 0x5, 0x48, 0x68, 0x2a, 0xb, 0x7c, 0xd, 0x60, 0xba, 0x67, 0x30, 0x2d, 0xa3}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1639,7 +1640,7 @@ func _1687506642_include_watch_only_account_settingUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1687506642_include_watch_only_account_setting.up.sql", size: 81, mode: os.FileMode(0644), modTime: time.Unix(1687966839, 0)}
|
||||
info := bindataFileInfo{name: "1687506642_include_watch_only_account_setting.up.sql", size: 81, mode: os.FileMode(0644), modTime: time.Unix(1687962760, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xaa, 0xa0, 0x61, 0xf8, 0xb9, 0x15, 0x22, 0x9a, 0xca, 0x9b, 0x89, 0x96, 0x90, 0x47, 0x56, 0xf3, 0x21, 0xf6, 0xbd, 0xd1, 0xa1, 0x8f, 0xa8, 0x34, 0xc3, 0x54, 0x86, 0x69, 0x14, 0x96, 0xdb, 0xbb}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1659,11 +1660,31 @@ func _1688022264_add_include_watch_only_account_to_settings_sync_clockUpSql() (*
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1688022264_add_include_watch_only_account_to_settings_sync_clock.up.sql", size: 98, mode: os.FileMode(0644), modTime: time.Unix(1688036174, 0)}
|
||||
info := bindataFileInfo{name: "1688022264_add_include_watch_only_account_to_settings_sync_clock.up.sql", size: 98, mode: os.FileMode(0644), modTime: time.Unix(1688054623, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xab, 0xa2, 0x31, 0xcc, 0x3d, 0x59, 0x1b, 0x26, 0x5b, 0x78, 0xd, 0x6a, 0x75, 0x2a, 0xe0, 0x2, 0x21, 0x28, 0x8c, 0x92, 0x24, 0x98, 0x86, 0xdd, 0x2, 0x53, 0xe8, 0xf6, 0xc2, 0x7d, 0x57, 0x13}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var __1688054680_add_columns_to_multitransactionUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\xcf\x41\x0a\xc2\x30\x10\x40\xd1\xbd\xa7\x18\x7a\x0d\x57\x93\x26\xd6\x42\x4c\x21\x26\x6e\x43\xa8\x4a\x83\x36\x81\xcc\x88\x3d\xbe\xe8\xce\x9d\x05\x0f\xf0\x1f\x7c\xd4\x4e\x59\x70\x28\xb4\x82\xf9\x71\xe7\x14\xb8\xc6\x4c\x71\xe4\x54\x32\x01\x4a\x09\xed\xa0\xfd\xc1\xc0\xb5\x96\x39\xe4\x0b\x3f\x4b\xbd\x85\x74\x06\x6f\x8e\x7d\x67\x94\x04\xd1\x77\xbd\x71\xdb\xcd\xef\x14\x97\x3f\x41\x63\x2d\x44\x81\x97\x37\x73\x42\xdb\xee\xd1\x82\x54\x3b\xf4\xda\x41\xd3\xac\x91\x3e\x77\xbc\x84\x29\xd2\x04\x42\x0f\x62\xe5\xcf\x77\xfa\x0a\x00\x00\xff\xff\x09\x48\xcf\x50\x56\x01\x00\x00")
|
||||
|
||||
func _1688054680_add_columns_to_multitransactionUpSqlBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
__1688054680_add_columns_to_multitransactionUpSql,
|
||||
"1688054680_add_columns_to_multitransaction.up.sql",
|
||||
)
|
||||
}
|
||||
|
||||
func _1688054680_add_columns_to_multitransactionUpSql() (*asset, error) {
|
||||
bytes, err := _1688054680_add_columns_to_multitransactionUpSqlBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1688054680_add_columns_to_multitransaction.up.sql", size: 342, mode: os.FileMode(0644), modTime: time.Unix(1688054624, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb5, 0xbb, 0x88, 0xde, 0x98, 0x9e, 0xa8, 0xc0, 0xf7, 0x2b, 0xc4, 0x33, 0x77, 0xf5, 0x58, 0x46, 0x52, 0xc6, 0xc2, 0x27, 0x1d, 0x8, 0xc9, 0x83, 0xb6, 0x16, 0x31, 0x99, 0x15, 0xcb, 0xb1, 0x40}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _docGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2c\xc9\xb1\x0d\xc4\x20\x0c\x05\xd0\x9e\x29\xfe\x02\xd8\xfd\x6d\xe3\x4b\xac\x2f\x44\x82\x09\x78\x7f\xa5\x49\xfd\xa6\x1d\xdd\xe8\xd8\xcf\x55\x8a\x2a\xe3\x47\x1f\xbe\x2c\x1d\x8c\xfa\x6f\xe3\xb4\x34\xd4\xd9\x89\xbb\x71\x59\xb6\x18\x1b\x35\x20\xa2\x9f\x0a\x03\xa2\xe5\x0d\x00\x00\xff\xff\x60\xcd\x06\xbe\x4a\x00\x00\x00")
|
||||
|
||||
func docGoBytes() ([]byte, error) {
|
||||
|
@ -1679,7 +1700,7 @@ func docGo() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0644), modTime: time.Unix(1687889856, 0)}
|
||||
info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0644), modTime: time.Unix(1687956345, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xde, 0x7c, 0x28, 0xcd, 0x47, 0xf2, 0xfa, 0x7c, 0x51, 0x2d, 0xd8, 0x38, 0xb, 0xb0, 0x34, 0x9d, 0x4c, 0x62, 0xa, 0x9e, 0x28, 0xc3, 0x31, 0x23, 0xd9, 0xbb, 0x89, 0x9f, 0xa0, 0x89, 0x1f, 0xe8}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -1851,6 +1872,7 @@ var _bindata = map[string]func() (*asset, error){
|
|||
"1687269871_add_device_name.up.sql": _1687269871_add_device_nameUpSql,
|
||||
"1687506642_include_watch_only_account_setting.up.sql": _1687506642_include_watch_only_account_settingUpSql,
|
||||
"1688022264_add_include_watch_only_account_to_settings_sync_clock.up.sql": _1688022264_add_include_watch_only_account_to_settings_sync_clockUpSql,
|
||||
"1688054680_add_columns_to_multitransaction.up.sql": _1688054680_add_columns_to_multitransactionUpSql,
|
||||
"doc.go": docGo,
|
||||
}
|
||||
|
||||
|
@ -1976,6 +1998,7 @@ var _bintree = &bintree{nil, map[string]*bintree{
|
|||
"1687269871_add_device_name.up.sql": {_1687269871_add_device_nameUpSql, map[string]*bintree{}},
|
||||
"1687506642_include_watch_only_account_setting.up.sql": {_1687506642_include_watch_only_account_settingUpSql, map[string]*bintree{}},
|
||||
"1688022264_add_include_watch_only_account_to_settings_sync_clock.up.sql": {_1688022264_add_include_watch_only_account_to_settings_sync_clockUpSql, map[string]*bintree{}},
|
||||
"1688054680_add_columns_to_multitransaction.up.sql": {_1688054680_add_columns_to_multitransactionUpSql, map[string]*bintree{}},
|
||||
"doc.go": {docGo, map[string]*bintree{}},
|
||||
}}
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
ALTER TABLE multi_transactions ADD COLUMN from_network_id UNSIGNED BIGINT;
|
||||
ALTER TABLE multi_transactions ADD COLUMN to_network_id UNSIGNED BIGINT;
|
||||
ALTER TABLE multi_transactions ADD COLUMN cross_tx_id VARCHAR DEFAULT "";
|
||||
ALTER TABLE multi_transactions ADD COLUMN from_tx_hash BLOB;
|
||||
ALTER TABLE multi_transactions ADD COLUMN to_tx_hash BLOB;
|
2
go.mod
2
go.mod
|
@ -2,7 +2,7 @@ module github.com/status-im/status-go
|
|||
|
||||
go 1.19
|
||||
|
||||
replace github.com/ethereum/go-ethereum v1.10.26 => github.com/status-im/go-ethereum v1.10.25-status.6
|
||||
replace github.com/ethereum/go-ethereum v1.10.26 => github.com/status-im/go-ethereum v1.10.25-status.7
|
||||
|
||||
replace github.com/docker/docker => github.com/docker/engine v1.4.2-0.20190717161051-705d9623b7c1
|
||||
|
||||
|
|
4
go.sum
4
go.sum
|
@ -1975,8 +1975,8 @@ github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/y
|
|||
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
|
||||
github.com/status-im/doubleratchet v3.0.0+incompatible h1:aJ1ejcSERpSzmWZBgtfYtiU2nF0Q8ZkGyuEPYETXkCY=
|
||||
github.com/status-im/doubleratchet v3.0.0+incompatible/go.mod h1:1sqR0+yhiM/bd+wrdX79AOt2csZuJOni0nUDzKNuqOU=
|
||||
github.com/status-im/go-ethereum v1.10.25-status.6 h1:5YC8k1inTBqA6LpON0uX6y86niOKukA/LnKxzd5GFyI=
|
||||
github.com/status-im/go-ethereum v1.10.25-status.6/go.mod h1:Dt4K5JYMhJRdtXJwBEyGZLZn9iz/chSOZyjVmt5ZhwQ=
|
||||
github.com/status-im/go-ethereum v1.10.25-status.7 h1:egCCdvUQSdfnnDcv2vP1RCuIDr184eYlBvyucxuKJj8=
|
||||
github.com/status-im/go-ethereum v1.10.25-status.7/go.mod h1:Dt4K5JYMhJRdtXJwBEyGZLZn9iz/chSOZyjVmt5ZhwQ=
|
||||
github.com/status-im/go-multiaddr-ethv4 v1.2.5 h1:pN+ey6wYKbvNNu5/xq9+VL0N8Yq0pZUTbZp0URg+Yn4=
|
||||
github.com/status-im/go-multiaddr-ethv4 v1.2.5/go.mod h1:Fhe/18yWU5QwlAYiOO3Bb1BLe0bn5YobcNBHsjRr4kk=
|
||||
github.com/status-im/go-sqlcipher/v4 v4.5.4-status.2 h1:Oi9JTAI2DZEe5UKlpUcvKBCCSn3ULsLIrix7jPnEoPE=
|
||||
|
|
|
@ -25,6 +25,8 @@ const (
|
|||
Erc721Transfer Type = "erc721"
|
||||
UniswapV2Swap Type = "uniswapV2Swap"
|
||||
UniswapV3Swap Type = "uniswapV3Swap"
|
||||
HopBridgeFrom Type = "HopBridgeFrom"
|
||||
HopBridgeTo Type = "HopBridgeTo"
|
||||
unknownTransaction Type = "unknown"
|
||||
|
||||
// Event types
|
||||
|
@ -34,6 +36,8 @@ const (
|
|||
Erc721TransferEventType EventType = "erc721Event"
|
||||
UniswapV2SwapEventType EventType = "uniswapV2SwapEvent"
|
||||
UniswapV3SwapEventType EventType = "uniswapV3SwapEvent"
|
||||
HopBridgeTransferSentToL2EventType EventType = "hopBridgeTransferSentToL2Event"
|
||||
HopBridgeTransferFromL1CompletedEventType EventType = "hopBridgeTransferFromL1CompletedEvent"
|
||||
UnknownEventType EventType = "unknownEvent"
|
||||
|
||||
// Deposit (index_topic_1 address dst, uint256 wad)
|
||||
|
@ -52,6 +56,11 @@ const (
|
|||
uniswapV2SwapEventSignature = "Swap(address,uint256,uint256,uint256,uint256,address)" // also used by SushiSwap
|
||||
// Swap (index_topic_1 address sender, index_topic_2 address recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick)
|
||||
uniswapV3SwapEventSignature = "Swap(address,address,int256,int256,uint160,uint128,int24)"
|
||||
|
||||
// TransferSentToL2 (index_topic_1 uint256 chainId, index_topic_2 address recipient, uint256 amount, uint256 amountOutMin, uint256 deadline, index_topic_3 address relayer, uint256 relayerFee)
|
||||
hopBridgeTransferSentToL2EventSignature = "TransferSentToL2(uint256,address,uint256,uint256,uint256,address,uint256)"
|
||||
// TransferFromL1Completed (index_topic_1 address recipient, uint256 amount, uint256 amountOutMin, uint256 deadline, index_topic_2 address relayer, uint256 relayerFee)
|
||||
HopBridgeTransferFromL1CompletedEventSignature = "TransferFromL1Completed(address,uint256,uint256,uint256,address,uint256)"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -66,6 +75,8 @@ func GetEventType(log *types.Log) EventType {
|
|||
erc20_721TransferEventSignatureHash := GetEventSignatureHash(Erc20_721TransferEventSignature)
|
||||
uniswapV2SwapEventSignatureHash := GetEventSignatureHash(uniswapV2SwapEventSignature)
|
||||
uniswapV3SwapEventSignatureHash := GetEventSignatureHash(uniswapV3SwapEventSignature)
|
||||
hopBridgeTransferSentToL2EventSignatureHash := GetEventSignatureHash(hopBridgeTransferSentToL2EventSignature)
|
||||
hopBridgeTransferFromL1CompletedEventSignatureHash := GetEventSignatureHash(HopBridgeTransferFromL1CompletedEventSignature)
|
||||
|
||||
if len(log.Topics) > 0 {
|
||||
switch log.Topics[0] {
|
||||
|
@ -84,6 +95,10 @@ func GetEventType(log *types.Log) EventType {
|
|||
return UniswapV2SwapEventType
|
||||
case uniswapV3SwapEventSignatureHash:
|
||||
return UniswapV3SwapEventType
|
||||
case hopBridgeTransferSentToL2EventSignatureHash:
|
||||
return HopBridgeTransferSentToL2EventType
|
||||
case hopBridgeTransferFromL1CompletedEventSignatureHash:
|
||||
return HopBridgeTransferFromL1CompletedEventType
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,6 +115,10 @@ func EventTypeToSubtransactionType(eventType EventType) Type {
|
|||
return UniswapV2Swap
|
||||
case UniswapV3SwapEventType:
|
||||
return UniswapV3Swap
|
||||
case HopBridgeTransferSentToL2EventType:
|
||||
return HopBridgeFrom
|
||||
case HopBridgeTransferFromL1CompletedEventType:
|
||||
return HopBridgeTo
|
||||
}
|
||||
|
||||
return unknownTransaction
|
||||
|
@ -296,6 +315,74 @@ func ParseUniswapV3Log(ethlog *types.Log) (poolAddress common.Address, sender co
|
|||
return
|
||||
}
|
||||
|
||||
func ParseHopBridgeTransferSentToL2Log(ethlog *types.Log) (chainID uint64, recipient common.Address, relayer common.Address, amount *big.Int, err error) {
|
||||
chainIDInt := new(big.Int)
|
||||
amount = new(big.Int)
|
||||
|
||||
if len(ethlog.Topics) < 4 {
|
||||
err = fmt.Errorf("not enough topics for HopBridgeTransferSentToL2 event %s, %v", "topics", ethlog.Topics)
|
||||
return
|
||||
}
|
||||
|
||||
if len(ethlog.Topics[1]) != 32 {
|
||||
err = fmt.Errorf("second topic is not padded to 32 byte address %s, %v", "topic", ethlog.Topics[1])
|
||||
return
|
||||
}
|
||||
chainIDInt.SetBytes(ethlog.Topics[1][:])
|
||||
chainID = chainIDInt.Uint64()
|
||||
|
||||
if len(ethlog.Topics[2]) != 32 {
|
||||
err = fmt.Errorf("third topic is not padded to 32 byte address %s, %v", "topic", ethlog.Topics[2])
|
||||
return
|
||||
}
|
||||
copy(recipient[:], ethlog.Topics[2][12:])
|
||||
|
||||
if len(ethlog.Topics[3]) != 32 {
|
||||
err = fmt.Errorf("fourth topic is not padded to 32 byte address %s, %v", "topic", ethlog.Topics[3])
|
||||
return
|
||||
}
|
||||
copy(relayer[:], ethlog.Topics[3][12:])
|
||||
|
||||
if len(ethlog.Data) != 32*4 {
|
||||
err = fmt.Errorf("data is not padded to 4 * 32 bytes big int %s, %v", "data", ethlog.Data)
|
||||
return
|
||||
}
|
||||
|
||||
amount.SetBytes(ethlog.Data[0:32])
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func ParseHopBridgeTransferFromL1CompletedLog(ethlog *types.Log) (recipient common.Address, relayer common.Address, amount *big.Int, err error) {
|
||||
amount = new(big.Int)
|
||||
|
||||
if len(ethlog.Topics) < 3 {
|
||||
err = fmt.Errorf("not enough topics for HopBridgeTransferFromL1Completed event %s, %v", "topics", ethlog.Topics)
|
||||
return
|
||||
}
|
||||
|
||||
if len(ethlog.Topics[1]) != 32 {
|
||||
err = fmt.Errorf("second topic is not padded to 32 byte address %s, %v", "topic", ethlog.Topics[1])
|
||||
return
|
||||
}
|
||||
copy(recipient[:], ethlog.Topics[1][12:])
|
||||
|
||||
if len(ethlog.Topics[2]) != 32 {
|
||||
err = fmt.Errorf("third topic is not padded to 32 byte address %s, %v", "topic", ethlog.Topics[2])
|
||||
return
|
||||
}
|
||||
copy(relayer[:], ethlog.Topics[2][12:])
|
||||
|
||||
if len(ethlog.Data) != 32*4 {
|
||||
err = fmt.Errorf("data is not padded to 4 * 32 bytes big int %s, %v", "data", ethlog.Data)
|
||||
return
|
||||
}
|
||||
|
||||
amount.SetBytes(ethlog.Data[0:32])
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func GetEventSignatureHash(signature string) common.Hash {
|
||||
return crypto.Keccak256Hash([]byte(signature))
|
||||
}
|
||||
|
@ -333,3 +420,35 @@ func ExtractTokenIdentity(dbEntryType Type, log *types.Log, tx *types.Transactio
|
|||
|
||||
return
|
||||
}
|
||||
|
||||
func TxDataContainsAddress(txType uint8, txData []byte, address common.Address) bool {
|
||||
// First 4 bytes are related to the methodID
|
||||
const methodIDLen int = 4
|
||||
const paramLen int = 32
|
||||
|
||||
var paramOffset int = 0
|
||||
switch txType {
|
||||
case types.OptimismDepositTxType:
|
||||
// Offset for relayMessage data.
|
||||
// I actually don't know what the 2x32 + 4 bytes mean, but it seems to be constant in all transactions I've
|
||||
// checked. Will update the comment when I find out more about it.
|
||||
paramOffset = 5*32 + 2*32 + 4
|
||||
}
|
||||
|
||||
// Check if address is contained in any 32-byte parameter
|
||||
for paramStart := methodIDLen + paramOffset; paramStart < len(txData); paramStart += paramLen {
|
||||
paramEnd := paramStart + paramLen
|
||||
|
||||
if paramEnd > len(txData) {
|
||||
break
|
||||
}
|
||||
|
||||
// Address bytes should be in the last addressLen positions
|
||||
paramBytes := txData[paramStart:paramEnd]
|
||||
paramAddress := common.BytesToAddress(paramBytes)
|
||||
if address == paramAddress {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestLegacyTxDataContainsAddress(t *testing.T) {
|
||||
txDataString := "deace8f5000000000000000000000000000000000000000000000000000000000000000a00000000000000000" +
|
||||
"0000000d6255ae13ac335b347aa846802ad6ac39dd2543a000000000000000000000000000000000000000000000000002c68af0bb" +
|
||||
"14000000000000000000000000000000000000000000000000000002c29ddae0698830000000000000000000000000000000000000" +
|
||||
"0000000000000000000649a33b3000000000000000000000000710bda329b2a6224e4b44833de30f38e7f81d564000000000000000" +
|
||||
"0000000000000000000000000000000000000000000000000"
|
||||
|
||||
txData, err := hex.DecodeString(txDataString)
|
||||
require.NoError(t, err)
|
||||
|
||||
containedAddress := common.HexToAddress("0xd6255aE13aC335b347aa846802aD6aC39dd2543a")
|
||||
randomAddress := common.HexToAddress("0xb8901acB165ed027E32754E0FFe830802919727f")
|
||||
|
||||
require.True(t, TxDataContainsAddress(types.LegacyTxType, txData, containedAddress))
|
||||
require.False(t, TxDataContainsAddress(types.LegacyTxType, txData, randomAddress))
|
||||
}
|
||||
|
||||
func TestOptDepositTxDataContainsAddress(t *testing.T) {
|
||||
txDataString := "d764ad0b00010000000000000000000000000000000000000000000000000000000019b7000000000000000000000000a45df1a388049fb8d76e72d350d24e2c3f7aebd100000000000000000000000083f6244bd87662118d96d9a6d44f09dfff14b30e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000249f000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000c4cc29a306000000000000000000000000e813d34c0525e0fbb1e6478b86d40b83603c200800000000000000000000000000000000000000000000000000470de4df8200000000000000000000000000000000000000000000000000000046a8e2b55dea2100000000000000000000000000000000000000000000000000000000649d6931000000000000000000000000710bda329b2a6224e4b44833de30f38e7f81d564000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
|
||||
txData, err := hex.DecodeString(txDataString)
|
||||
require.NoError(t, err)
|
||||
|
||||
containedAddress := common.HexToAddress("0xE813d34C0525E0fBb1e6478B86D40B83603C2008")
|
||||
randomAddress := common.HexToAddress("0xb8901acB165ed027E32754E0FFe830802919727f")
|
||||
|
||||
require.True(t, TxDataContainsAddress(types.OptimismDepositTxType, txData, containedAddress))
|
||||
require.False(t, TxDataContainsAddress(types.OptimismDepositTxType, txData, randomAddress))
|
||||
}
|
||||
|
||||
func TestLogHopBridgeTransferSentToL2(t *testing.T) {
|
||||
eventLogTestData := `{"address":"0xb8901acb165ed027e32754e0ffe830802919727f","topics":["0x0a0607688c86ec1775abcdbab7b33a3a35a6c9cde677c9be880150c231cc6b0b","0x000000000000000000000000000000000000000000000000000000000000000a","0x000000000000000000000000d6255ae13ac335b347aa846802ad6ac39dd2543a","0x000000000000000000000000710bda329b2a6224e4b44833de30f38e7f81d564"],"data":"0x000000000000000000000000000000000000000000000000002c68af0bb14000000000000000000000000000000000000000000000000000002c29ddae06988300000000000000000000000000000000000000000000000000000000649a33b30000000000000000000000000000000000000000000000000000000000000000","blockNumber":"0x10b4baf","transactionHash":"0xfc4687f8d985ef0cc86d79a0c7abc582552b8bae0e13a90c59eeadf7e64ed569","transactionIndex":"0x48","blockHash":"0xea7f003d02a43be4dfec836803a033c0ce22ecf9a48d4a3ed3700db9c722d994","logIndex":"0xfa","removed":false}`
|
||||
var eventLog types.Log
|
||||
err := json.Unmarshal([]byte(eventLogTestData), &eventLog)
|
||||
require.NoError(t, err)
|
||||
|
||||
eventType := GetEventType(&eventLog)
|
||||
require.Equal(t, HopBridgeTransferSentToL2EventType, eventType)
|
||||
}
|
||||
|
||||
func TestLogHopBridgeTransferFromL1Completed(t *testing.T) {
|
||||
eventLogTestData := `{"address":"0x83f6244Bd87662118d96D9a6D44f09dffF14b30E","topics":["0x320958176930804eb66c2343c7343fc0367dc16249590c0f195783bee199d094","0x000000000000000000000000d6255ae13ac335b347aa846802ad6ac39dd2543a","0x000000000000000000000000710bda329b2a6224e4b44833de30f38e7f81d564"],"data":"0x000000000000000000000000000000000000000000000000002c68af0bb14000000000000000000000000000000000000000000000000000002c29ddae06988300000000000000000000000000000000000000000000000000000000649a33b30000000000000000000000000000000000000000000000000000000000000000","blockNumber":"0x64E8FF0","transactionHash":"0x67a6f407824be389e6a960ebb1ddbe7e2f24a809a86b50452ee3dc70cc708d00","transactionIndex":"0x48","blockHash":"0xea7f003d02a43be4dfec836803a033c0ce22ecf9a48d4a3ed3700db9c722d994","logIndex":"0xfa","removed":false}`
|
||||
var eventLog types.Log
|
||||
err := json.Unmarshal([]byte(eventLogTestData), &eventLog)
|
||||
require.NoError(t, err)
|
||||
|
||||
eventType := GetEventType(&eventLog)
|
||||
require.Equal(t, HopBridgeTransferFromL1CompletedEventType, eventType)
|
||||
}
|
|
@ -0,0 +1,130 @@
|
|||
package transfer
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/status-im/status-go/rpc/chain"
|
||||
w_common "github.com/status-im/status-go/services/wallet/common"
|
||||
"github.com/status-im/status-go/services/wallet/token"
|
||||
)
|
||||
|
||||
// TODO: Find proper way to uniquely match Origin and Destination transactions (some sort of hash or uniqueID)
|
||||
// Current approach is not failsafe (for example, if multiple identical bridge operations are triggered
|
||||
// at the same time)
|
||||
// Recipient + Relayer + Data should match in both Origin and Destination transactions
|
||||
func getHopBridgeCrossTxID(recipient common.Address, relayer common.Address, logData []byte) string {
|
||||
return fmt.Sprintf("%s_%s_%s", recipient.String(), relayer.String(), hex.EncodeToString(logData))
|
||||
}
|
||||
|
||||
func buildHopBridgeMultitransaction(ctx context.Context, client *chain.ClientWithFallback, transactionManager *TransactionManager, tokenManager *token.Manager, subTx *Transfer) (*MultiTransaction, error) {
|
||||
// Identify if it's from/to transaction
|
||||
switch w_common.GetEventType(subTx.Log) {
|
||||
case w_common.HopBridgeTransferSentToL2EventType:
|
||||
// L1-L2 Origin transaciton
|
||||
fromChainID := subTx.NetworkID
|
||||
fromTxHash := subTx.Receipt.TxHash
|
||||
|
||||
toChainID, recipient, relayer, fromAmount, err := w_common.ParseHopBridgeTransferSentToL2Log(subTx.Log)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
crossTxID := getHopBridgeCrossTxID(recipient, relayer, subTx.Log.Data)
|
||||
|
||||
// Try to find "destination" half of the multiTx
|
||||
multiTx, err := transactionManager.GetBridgeDestinationMultiTransaction(ctx, toChainID, crossTxID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if multiTx == nil {
|
||||
multiTx = &MultiTransaction{
|
||||
// Data from "origin" transaction
|
||||
FromNetworkID: fromChainID,
|
||||
FromTxHash: fromTxHash,
|
||||
FromAddress: subTx.From,
|
||||
FromAsset: "ETH",
|
||||
FromAmount: (*hexutil.Big)(fromAmount),
|
||||
ToNetworkID: toChainID,
|
||||
ToAddress: recipient,
|
||||
// To be replaced by "destination" transaction, need to be non-null
|
||||
ToAmount: (*hexutil.Big)(fromAmount),
|
||||
// Common data
|
||||
Type: MultiTransactionBridge,
|
||||
CrossTxID: crossTxID,
|
||||
}
|
||||
|
||||
_, err := transactionManager.InsertMultiTransaction(multiTx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
} else {
|
||||
multiTx.FromNetworkID = fromChainID
|
||||
multiTx.FromTxHash = fromTxHash
|
||||
multiTx.FromAddress = subTx.From
|
||||
multiTx.FromAsset = "ETH"
|
||||
multiTx.FromAmount = (*hexutil.Big)(fromAmount)
|
||||
|
||||
err := transactionManager.UpdateMultiTransaction(multiTx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return multiTx, nil
|
||||
|
||||
case w_common.HopBridgeTransferFromL1CompletedEventType:
|
||||
// L1-L2 Destination transaciton
|
||||
toChainID := subTx.NetworkID
|
||||
toTxHash := subTx.Receipt.TxHash
|
||||
|
||||
recipient, relayer, toAmount, err := w_common.ParseHopBridgeTransferFromL1CompletedLog(subTx.Log)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
crossTxID := getHopBridgeCrossTxID(recipient, relayer, subTx.Log.Data)
|
||||
|
||||
// Try to find "origin" half of the multiTx
|
||||
multiTx, err := transactionManager.GetBridgeOriginMultiTransaction(ctx, toChainID, crossTxID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if multiTx == nil {
|
||||
multiTx = &MultiTransaction{
|
||||
// To be replaced by "origin" transaction, need to be non-null
|
||||
FromAddress: recipient,
|
||||
FromAsset: "ETH",
|
||||
FromAmount: (*hexutil.Big)(toAmount),
|
||||
// Data from "destination" transaction
|
||||
ToNetworkID: toChainID,
|
||||
ToTxHash: toTxHash,
|
||||
ToAddress: recipient,
|
||||
ToAsset: "ETH",
|
||||
ToAmount: (*hexutil.Big)(toAmount),
|
||||
// Common data
|
||||
Type: MultiTransactionBridge,
|
||||
CrossTxID: crossTxID,
|
||||
}
|
||||
|
||||
_, err := transactionManager.InsertMultiTransaction(multiTx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
multiTx.ToTxHash = toTxHash
|
||||
multiTx.ToAsset = "ETH"
|
||||
multiTx.ToAmount = (*hexutil.Big)(toAmount)
|
||||
|
||||
err := transactionManager.UpdateMultiTransaction(multiTx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return multiTx, nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
|
@ -491,6 +491,26 @@ func (c *transfersCommand) checkAndProcessSwapMultiTx(ctx context.Context, tx Tr
|
|||
return false, nil
|
||||
}
|
||||
|
||||
func (c *transfersCommand) checkAndProcessBridgeMultiTx(ctx context.Context, tx Transaction) (bool, error) {
|
||||
for _, subTx := range tx {
|
||||
switch subTx.Type {
|
||||
// If the Tx contains any hopBridge subTx, create/update Bridge multiTx
|
||||
case w_common.HopBridgeFrom, w_common.HopBridgeTo:
|
||||
multiTransaction, err := buildHopBridgeMultitransaction(ctx, c.chainClient, c.transactionManager, c.tokenManager, subTx)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
if multiTransaction != nil {
|
||||
setMultiTxID(tx, MultiTransactionIDType(multiTransaction.ID))
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func (c *transfersCommand) processMultiTransactions(ctx context.Context, allTransfers []Transfer) error {
|
||||
txByTxHash := subTransactionListToTransactionsByTxHash(allTransfers)
|
||||
|
||||
|
@ -505,7 +525,16 @@ func (c *transfersCommand) processMultiTransactions(ctx context.Context, allTran
|
|||
}
|
||||
|
||||
// Then check for a Swap transaction
|
||||
_, err = c.checkAndProcessSwapMultiTx(ctx, tx)
|
||||
txProcessed, err := c.checkAndProcessSwapMultiTx(ctx, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if txProcessed {
|
||||
continue
|
||||
}
|
||||
|
||||
// Then check for a Bridge transaction
|
||||
_, err = c.checkAndProcessBridgeMultiTx(ctx, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -694,7 +723,7 @@ func (c *findAndCheckBlockRangeCommand) fastIndexErc20(ctx context.Context, from
|
|||
commands := make([]*erc20HistoricalCommand, len(c.accounts))
|
||||
for i, address := range c.accounts {
|
||||
erc20 := &erc20HistoricalCommand{
|
||||
erc20: NewERC20TransfersDownloader(c.chainClient, []common.Address{address}, types.NewLondonSigner(c.chainClient.ToBigInt())),
|
||||
erc20: NewERC20TransfersDownloader(c.chainClient, []common.Address{address}, types.LatestSignerForChainID(c.chainClient.ToBigInt())),
|
||||
chainClient: c.chainClient,
|
||||
feed: c.feed,
|
||||
address: address,
|
||||
|
@ -735,7 +764,7 @@ func loadTransfers(ctx context.Context, accounts []common.Address, blockDAO *Blo
|
|||
eth: ÐDownloader{
|
||||
chainClient: chainClient,
|
||||
accounts: []common.Address{address},
|
||||
signer: types.NewLondonSigner(chainClient.ToBigInt()),
|
||||
signer: types.LatestSignerForChainID(chainClient.ToBigInt()),
|
||||
db: db,
|
||||
},
|
||||
blockNums: blocksByAddress[address],
|
||||
|
|
|
@ -296,7 +296,7 @@ func (c *findBlocksCommand) fastIndexErc20(ctx context.Context, fromBlockNumber
|
|||
group := async.NewGroup(ctx)
|
||||
|
||||
erc20 := &erc20HistoricalCommand{
|
||||
erc20: NewERC20TransfersDownloader(c.chainClient, []common.Address{c.account}, types.NewLondonSigner(c.chainClient.ToBigInt())),
|
||||
erc20: NewERC20TransfersDownloader(c.chainClient, []common.Address{c.account}, types.LatestSignerForChainID(c.chainClient.ToBigInt())),
|
||||
chainClient: c.chainClient,
|
||||
feed: c.feed,
|
||||
address: c.account,
|
||||
|
|
|
@ -193,7 +193,7 @@ func (c *Controller) LoadTransferByHash(ctx context.Context, rpcClient *rpc.Clie
|
|||
return err
|
||||
}
|
||||
|
||||
signer := types.NewLondonSigner(chainClient.ToBigInt())
|
||||
signer := types.LatestSignerForChainID(chainClient.ToBigInt())
|
||||
|
||||
transfer, err := getTransferByHash(ctx, chainClient, signer, address, hash)
|
||||
if err != nil {
|
||||
|
@ -231,7 +231,7 @@ func (c *Controller) GetTransfersByAddress(ctx context.Context, chainID uint64,
|
|||
func (c *Controller) GetTransfersForIdentities(ctx context.Context, identities []TransactionIdentity) ([]View, error) {
|
||||
rst, err := c.db.GetTransfersForIdentities(ctx, identities)
|
||||
if err != nil {
|
||||
log.Error("[transfer.Controller.GetTransfersByAddress] DB err", err)
|
||||
log.Error("[transfer.Controller.GetTransfersForIdentities] DB err", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
|
@ -153,13 +153,17 @@ func (d *ETHDownloader) getTransfersInBlock(ctx context.Context, blk *types.Bloc
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
areSubTxsCheckedForTxHash := make(map[common.Hash]bool)
|
||||
|
||||
for _, t := range transactionsToLoad {
|
||||
subtransactions, err := d.subTransactionsFromTransactionHash(ctx, t.Log.TxHash, address)
|
||||
if err != nil {
|
||||
log.Error("can't fetch erc20 transfer from log", "error", err)
|
||||
log.Error("can't fetch subTxs for erc20/erc721 transfer", "error", err)
|
||||
return nil, err
|
||||
}
|
||||
rst = append(rst, subtransactions...)
|
||||
areSubTxsCheckedForTxHash[t.Log.TxHash] = true
|
||||
}
|
||||
|
||||
for _, tx := range blk.Transactions() {
|
||||
|
@ -176,24 +180,46 @@ func (d *ETHDownloader) getTransfersInBlock(ctx context.Context, blk *types.Bloc
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if from == address || (tx.To() != nil && *tx.To() == address) {
|
||||
isPlainTransfer := from == address || (tx.To() != nil && *tx.To() == address)
|
||||
mustCheckSubTxs := false
|
||||
|
||||
if !isPlainTransfer {
|
||||
// We might miss some subTransactions of interest for some transaction types. We need to check if we
|
||||
// find the address in the transaction data.
|
||||
switch tx.Type() {
|
||||
case types.OptimismDepositTxType, types.ArbitrumDepositTxType, types.ArbitrumRetryTxType:
|
||||
mustCheckSubTxs = !areSubTxsCheckedForTxHash[tx.Hash()] && w_common.TxDataContainsAddress(tx.Type(), tx.Data(), address)
|
||||
}
|
||||
}
|
||||
|
||||
if isPlainTransfer || mustCheckSubTxs {
|
||||
receipt, err := d.chainClient.TransactionReceipt(ctx, tx.Hash())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
eventType, _ := w_common.GetFirstEvent(receipt.Logs)
|
||||
|
||||
baseGasFee, err := d.chainClient.GetBaseFeeFromBlock(blk.Number())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// If the transaction is not already some known transfer type, add it
|
||||
// to the list as a plain eth transfer
|
||||
if eventType == w_common.UnknownEventType {
|
||||
// Since we've already got the receipt, check for subTxs of
|
||||
// interest in case we haven't already.
|
||||
if !areSubTxsCheckedForTxHash[tx.Hash()] {
|
||||
subtransactions, err := d.subTransactionsFromTransactionData(tx, receipt, blk, baseGasFee, address)
|
||||
if err != nil {
|
||||
log.Error("can't fetch subTxs for eth transfer", "error", err)
|
||||
return nil, err
|
||||
}
|
||||
rst = append(rst, subtransactions...)
|
||||
areSubTxsCheckedForTxHash[tx.Hash()] = true
|
||||
}
|
||||
|
||||
// If it's a plain ETH transfer, add it to the list
|
||||
if isPlainTransfer {
|
||||
rst = append(rst, Transfer{
|
||||
Type: w_common.EthTransfer,
|
||||
NetworkID: tx.ChainId().Uint64(),
|
||||
ID: tx.Hash(),
|
||||
Address: address,
|
||||
BlockNumber: blk.Number(),
|
||||
|
@ -263,12 +289,16 @@ func (d *ETHDownloader) subTransactionsFromTransactionHash(parent context.Contex
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
from, err := types.Sender(d.signer, tx)
|
||||
|
||||
ctx, cancel = context.WithTimeout(parent, 3*time.Second)
|
||||
receipt, err := d.chainClient.TransactionReceipt(ctx, txHash)
|
||||
cancel()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ctx, cancel = context.WithTimeout(parent, 3*time.Second)
|
||||
receipt, err := d.chainClient.TransactionReceipt(ctx, txHash)
|
||||
blk, err := d.chainClient.BlockByHash(ctx, receipt.BlockHash)
|
||||
cancel()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -279,10 +309,15 @@ func (d *ETHDownloader) subTransactionsFromTransactionHash(parent context.Contex
|
|||
return nil, err
|
||||
}
|
||||
|
||||
ctx, cancel = context.WithTimeout(parent, 3*time.Second)
|
||||
blk, err := d.chainClient.BlockByHash(ctx, receipt.BlockHash)
|
||||
cancel()
|
||||
return d.subTransactionsFromTransactionData(tx, receipt, blk, baseGasFee, address)
|
||||
}
|
||||
|
||||
func (d *ETHDownloader) subTransactionsFromTransactionData(tx *types.Transaction, receipt *types.Receipt, blk *types.Block, baseGasFee string, address common.Address) ([]Transfer, error) {
|
||||
from, err := types.Sender(d.signer, tx)
|
||||
if err != nil {
|
||||
if err == core.ErrTxTypeNotSupported {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
@ -295,17 +330,19 @@ func (d *ETHDownloader) subTransactionsFromTransactionHash(parent context.Contex
|
|||
mustAppend := false
|
||||
switch eventType {
|
||||
case w_common.Erc20TransferEventType:
|
||||
from, to, _ := w_common.ParseErc20TransferLog(log)
|
||||
if from == address || to == address {
|
||||
trFrom, trTo, _ := w_common.ParseErc20TransferLog(log)
|
||||
if trFrom == address || trTo == address {
|
||||
mustAppend = true
|
||||
}
|
||||
case w_common.Erc721TransferEventType:
|
||||
from, to, _ := w_common.ParseErc721TransferLog(log)
|
||||
if from == address || to == address {
|
||||
trFrom, trTo, _ := w_common.ParseErc721TransferLog(log)
|
||||
if trFrom == address || trTo == address {
|
||||
mustAppend = true
|
||||
}
|
||||
case w_common.UniswapV2SwapEventType, w_common.UniswapV3SwapEventType:
|
||||
mustAppend = true
|
||||
case w_common.HopBridgeTransferSentToL2EventType, w_common.HopBridgeTransferFromL1CompletedEventType:
|
||||
mustAppend = true
|
||||
}
|
||||
|
||||
if mustAppend {
|
||||
|
@ -316,6 +353,7 @@ func (d *ETHDownloader) subTransactionsFromTransactionHash(parent context.Contex
|
|||
BlockNumber: new(big.Int).SetUint64(log.BlockNumber),
|
||||
BlockHash: log.BlockHash,
|
||||
Loaded: true,
|
||||
NetworkID: d.signer.ChainID().Uint64(),
|
||||
From: from,
|
||||
Log: log,
|
||||
BaseGasFees: baseGasFee,
|
||||
|
|
|
@ -70,7 +70,7 @@ type OnDemandFetchStrategy struct {
|
|||
}
|
||||
|
||||
func (s *OnDemandFetchStrategy) newControlCommand(chainClient *chain.ClientWithFallback, accounts []common.Address) *controlCommand {
|
||||
signer := types.NewLondonSigner(chainClient.ToBigInt())
|
||||
signer := types.LatestSignerForChainID(chainClient.ToBigInt())
|
||||
ctl := &controlCommand{
|
||||
db: s.db,
|
||||
chainClient: chainClient,
|
||||
|
|
|
@ -204,7 +204,11 @@ func fetchUniswapInfo(ctx context.Context, client *chain.ClientWithFallback, tok
|
|||
func buildUniswapSwapMultitransaction(ctx context.Context, client *chain.ClientWithFallback, tokenManager *token.Manager, transfer *Transfer) (*MultiTransaction, error) {
|
||||
multiTransaction := MultiTransaction{
|
||||
Type: MultiTransactionSwap,
|
||||
FromNetworkID: transfer.NetworkID,
|
||||
FromTxHash: transfer.Receipt.TxHash,
|
||||
FromAddress: transfer.Address,
|
||||
ToNetworkID: transfer.NetworkID,
|
||||
ToTxHash: transfer.Receipt.TxHash,
|
||||
ToAddress: transfer.Address,
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,10 @@ func NewTransactionManager(db *sql.DB, gethManager *account.GethManager, transac
|
|||
}
|
||||
}
|
||||
|
||||
var (
|
||||
emptyHash = common.Hash{}
|
||||
)
|
||||
|
||||
type MultiTransactionType uint8
|
||||
|
||||
const (
|
||||
|
@ -63,6 +67,10 @@ const (
|
|||
type MultiTransaction struct {
|
||||
ID uint `json:"id"`
|
||||
Timestamp uint64 `json:"timestamp"`
|
||||
FromNetworkID uint64 `json:"fromNetworkID"`
|
||||
ToNetworkID uint64 `json:"toNetworkID"`
|
||||
FromTxHash common.Hash `json:"fromTxHash"`
|
||||
ToTxHash common.Hash `json:"toTxHash"`
|
||||
FromAddress common.Address `json:"fromAddress"`
|
||||
ToAddress common.Address `json:"toAddress"`
|
||||
FromAsset string `json:"fromAsset"`
|
||||
|
@ -70,6 +78,7 @@ type MultiTransaction struct {
|
|||
FromAmount *hexutil.Big `json:"fromAmount"`
|
||||
ToAmount *hexutil.Big `json:"toAmount"`
|
||||
Type MultiTransactionType `json:"type"`
|
||||
CrossTxID string
|
||||
}
|
||||
|
||||
type MultiTransactionCommand struct {
|
||||
|
@ -321,29 +330,85 @@ func (tm *TransactionManager) Watch(ctx context.Context, transactionHash common.
|
|||
return watchTxCommand.Command()(commandContext)
|
||||
}
|
||||
|
||||
const multiTransactionColumns = "from_address, from_asset, from_amount, to_address, to_asset, to_amount, type, timestamp"
|
||||
const multiTransactionColumns = "from_network_id, from_tx_hash, from_address, from_asset, from_amount, to_network_id, to_tx_hash, to_address, to_asset, to_amount, type, cross_tx_id, timestamp"
|
||||
|
||||
func rowsToMultiTransactions(rows *sql.Rows) ([]*MultiTransaction, error) {
|
||||
var multiTransactions []*MultiTransaction
|
||||
for rows.Next() {
|
||||
multiTransaction := &MultiTransaction{}
|
||||
var fromAmountDB, toAmountDB sql.NullString
|
||||
err := rows.Scan(
|
||||
&multiTransaction.ID,
|
||||
&multiTransaction.FromNetworkID,
|
||||
&multiTransaction.FromTxHash,
|
||||
&multiTransaction.FromAddress,
|
||||
&multiTransaction.FromAsset,
|
||||
&fromAmountDB,
|
||||
&multiTransaction.ToNetworkID,
|
||||
&multiTransaction.ToTxHash,
|
||||
&multiTransaction.ToAddress,
|
||||
&multiTransaction.ToAsset,
|
||||
&toAmountDB,
|
||||
&multiTransaction.Type,
|
||||
&multiTransaction.CrossTxID,
|
||||
&multiTransaction.Timestamp,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if fromAmountDB.Valid {
|
||||
multiTransaction.FromAmount = new(hexutil.Big)
|
||||
if _, ok := (*big.Int)(multiTransaction.FromAmount).SetString(fromAmountDB.String, 0); !ok {
|
||||
return nil, errors.New("failed to convert fromAmountDB.String to big.Int: " + fromAmountDB.String)
|
||||
}
|
||||
}
|
||||
|
||||
if toAmountDB.Valid {
|
||||
multiTransaction.ToAmount = new(hexutil.Big)
|
||||
if _, ok := (*big.Int)(multiTransaction.ToAmount).SetString(toAmountDB.String, 0); !ok {
|
||||
return nil, errors.New("failed to convert fromAmountDB.String to big.Int: " + toAmountDB.String)
|
||||
}
|
||||
}
|
||||
|
||||
multiTransactions = append(multiTransactions, multiTransaction)
|
||||
}
|
||||
|
||||
return multiTransactions, nil
|
||||
}
|
||||
|
||||
func insertMultiTransaction(db *sql.DB, multiTransaction *MultiTransaction) (MultiTransactionIDType, error) {
|
||||
insert, err := db.Prepare(fmt.Sprintf(`INSERT OR REPLACE INTO multi_transactions (%s)
|
||||
VALUES(?, ?, ?, ?, ?, ?, ?, ?)`, multiTransactionColumns))
|
||||
insert, err := db.Prepare(fmt.Sprintf(`INSERT INTO multi_transactions (%s)
|
||||
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, multiTransactionColumns))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
timestamp := time.Now().Unix()
|
||||
result, err := insert.Exec(
|
||||
multiTransaction.FromNetworkID,
|
||||
multiTransaction.FromTxHash,
|
||||
multiTransaction.FromAddress,
|
||||
multiTransaction.FromAsset,
|
||||
multiTransaction.FromAmount.String(),
|
||||
multiTransaction.ToNetworkID,
|
||||
multiTransaction.ToTxHash,
|
||||
multiTransaction.ToAddress,
|
||||
multiTransaction.ToAsset,
|
||||
multiTransaction.ToAmount.String(),
|
||||
multiTransaction.Type,
|
||||
time.Now().Unix(),
|
||||
multiTransaction.CrossTxID,
|
||||
timestamp,
|
||||
)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
defer insert.Close()
|
||||
multiTransactionID, err := result.LastInsertId()
|
||||
|
||||
multiTransaction.Timestamp = uint64(timestamp)
|
||||
multiTransaction.ID = uint(multiTransactionID)
|
||||
|
||||
return MultiTransactionIDType(multiTransactionID), err
|
||||
}
|
||||
|
||||
|
@ -351,6 +416,43 @@ func (tm *TransactionManager) InsertMultiTransaction(multiTransaction *MultiTran
|
|||
return insertMultiTransaction(tm.db, multiTransaction)
|
||||
}
|
||||
|
||||
func updateMultiTransaction(db *sql.DB, multiTransaction *MultiTransaction) error {
|
||||
if MultiTransactionIDType(multiTransaction.ID) == NoMultiTransactionID {
|
||||
return fmt.Errorf("no multitransaction ID")
|
||||
}
|
||||
|
||||
update, err := db.Prepare(fmt.Sprintf(`REPLACE INTO multi_transactions (rowid, %s)
|
||||
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, multiTransactionColumns))
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = update.Exec(
|
||||
multiTransaction.ID,
|
||||
multiTransaction.FromNetworkID,
|
||||
multiTransaction.FromTxHash,
|
||||
multiTransaction.FromAddress,
|
||||
multiTransaction.FromAsset,
|
||||
multiTransaction.FromAmount.String(),
|
||||
multiTransaction.ToNetworkID,
|
||||
multiTransaction.ToTxHash,
|
||||
multiTransaction.ToAddress,
|
||||
multiTransaction.ToAsset,
|
||||
multiTransaction.ToAmount.String(),
|
||||
multiTransaction.Type,
|
||||
multiTransaction.CrossTxID,
|
||||
time.Now().Unix(),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return update.Close()
|
||||
}
|
||||
|
||||
func (tm *TransactionManager) UpdateMultiTransaction(multiTransaction *MultiTransaction) error {
|
||||
return updateMultiTransaction(tm.db, multiTransaction)
|
||||
}
|
||||
|
||||
func (tm *TransactionManager) CreateMultiTransactionFromCommand(ctx context.Context, command *MultiTransactionCommand, data []*bridge.TransactionBridge, bridges map[string]bridge.Bridge, password string) (*MultiTransactionCommandResult, error) {
|
||||
multiTransaction := &MultiTransaction{
|
||||
FromAddress: command.FromAddress,
|
||||
|
@ -427,43 +529,58 @@ func (tm *TransactionManager) GetMultiTransactions(ctx context.Context, ids []Mu
|
|||
}
|
||||
defer rows.Close()
|
||||
|
||||
var multiTransactions []*MultiTransaction
|
||||
for rows.Next() {
|
||||
multiTransaction := &MultiTransaction{}
|
||||
var fromAmountDB, toAmountDB sql.NullString
|
||||
err := rows.Scan(
|
||||
&multiTransaction.ID,
|
||||
&multiTransaction.FromAddress,
|
||||
&multiTransaction.FromAsset,
|
||||
&fromAmountDB,
|
||||
&multiTransaction.ToAddress,
|
||||
&multiTransaction.ToAsset,
|
||||
&toAmountDB,
|
||||
&multiTransaction.Type,
|
||||
&multiTransaction.Timestamp,
|
||||
)
|
||||
return rowsToMultiTransactions(rows)
|
||||
}
|
||||
|
||||
func (tm *TransactionManager) getBridgeMultiTransactions(ctx context.Context, toChainID uint64, crossTxID string) ([]*MultiTransaction, error) {
|
||||
stmt, err := tm.db.Prepare(fmt.Sprintf(`SELECT rowid, %s
|
||||
FROM multi_transactions
|
||||
WHERE type=? AND to_network_id=? AND cross_tx_id=?`,
|
||||
multiTransactionColumns))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer stmt.Close()
|
||||
|
||||
rows, err := stmt.Query(MultiTransactionBridge, toChainID, crossTxID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
return rowsToMultiTransactions(rows)
|
||||
}
|
||||
|
||||
func (tm *TransactionManager) GetBridgeOriginMultiTransaction(ctx context.Context, toChainID uint64, crossTxID string) (*MultiTransaction, error) {
|
||||
multiTxs, err := tm.getBridgeMultiTransactions(ctx, toChainID, crossTxID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if fromAmountDB.Valid {
|
||||
multiTransaction.FromAmount = new(hexutil.Big)
|
||||
if _, ok := (*big.Int)(multiTransaction.FromAmount).SetString(fromAmountDB.String, 0); !ok {
|
||||
return nil, errors.New("failed to convert fromAmountDB.String to big.Int: " + fromAmountDB.String)
|
||||
for _, multiTx := range multiTxs {
|
||||
// Origin MultiTxs will have a missing "ToTxHash"
|
||||
if multiTx.ToTxHash == emptyHash {
|
||||
return multiTx, nil
|
||||
}
|
||||
}
|
||||
|
||||
if toAmountDB.Valid {
|
||||
multiTransaction.ToAmount = new(hexutil.Big)
|
||||
if _, ok := (*big.Int)(multiTransaction.ToAmount).SetString(toAmountDB.String, 0); !ok {
|
||||
return nil, errors.New("failed to convert fromAmountDB.String to big.Int: " + toAmountDB.String)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (tm *TransactionManager) GetBridgeDestinationMultiTransaction(ctx context.Context, toChainID uint64, crossTxID string) (*MultiTransaction, error) {
|
||||
multiTxs, err := tm.getBridgeMultiTransactions(ctx, toChainID, crossTxID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, multiTx := range multiTxs {
|
||||
// Destination MultiTxs will have a missing "FromTxHash"
|
||||
if multiTx.FromTxHash == emptyHash {
|
||||
return multiTx, nil
|
||||
}
|
||||
}
|
||||
|
||||
multiTransactions = append(multiTransactions, multiTransaction)
|
||||
}
|
||||
|
||||
return multiTransactions, nil
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (tm *TransactionManager) getVerifiedWalletAccount(address, password string) (*account.SelectedExtKey, error) {
|
||||
|
|
|
@ -23,6 +23,22 @@ func setupTestTransactionDB(t *testing.T) (*TransactionManager, func()) {
|
|||
}
|
||||
}
|
||||
|
||||
func areMultiTransactionsEqual(mt1, mt2 *MultiTransaction) bool {
|
||||
return mt1.Timestamp == mt2.Timestamp &&
|
||||
mt1.FromNetworkID == mt2.FromNetworkID &&
|
||||
mt1.ToNetworkID == mt2.ToNetworkID &&
|
||||
mt1.FromTxHash == mt2.FromTxHash &&
|
||||
mt1.ToTxHash == mt2.ToTxHash &&
|
||||
mt1.FromAddress == mt2.FromAddress &&
|
||||
mt1.ToAddress == mt2.ToAddress &&
|
||||
mt1.FromAsset == mt2.FromAsset &&
|
||||
mt1.ToAsset == mt2.ToAsset &&
|
||||
mt1.FromAmount.String() == mt2.FromAmount.String() &&
|
||||
mt1.ToAmount.String() == mt2.ToAmount.String() &&
|
||||
mt1.Type == mt2.Type &&
|
||||
mt1.CrossTxID == mt2.CrossTxID
|
||||
}
|
||||
|
||||
func TestPendingTransactions(t *testing.T) {
|
||||
manager, stop := setupTestTransactionDB(t)
|
||||
defer stop()
|
||||
|
@ -76,12 +92,16 @@ func TestPendingTransactions(t *testing.T) {
|
|||
require.Equal(t, 0, len(rst))
|
||||
}
|
||||
|
||||
func TestMultiTransactions(t *testing.T) {
|
||||
func TestBridgeMultiTransactions(t *testing.T) {
|
||||
manager, stop := setupTestTransactionDB(t)
|
||||
defer stop()
|
||||
|
||||
trx1 := MultiTransaction{
|
||||
Timestamp: 123,
|
||||
FromNetworkID: 0,
|
||||
ToNetworkID: 1,
|
||||
FromTxHash: common.Hash{5},
|
||||
// Empty ToTxHash
|
||||
FromAddress: common.Address{1},
|
||||
ToAddress: common.Address{2},
|
||||
FromAsset: "fromAsset",
|
||||
|
@ -89,32 +109,109 @@ func TestMultiTransactions(t *testing.T) {
|
|||
FromAmount: (*hexutil.Big)(big.NewInt(123)),
|
||||
ToAmount: (*hexutil.Big)(big.NewInt(234)),
|
||||
Type: MultiTransactionBridge,
|
||||
CrossTxID: "crossTxD1",
|
||||
}
|
||||
|
||||
trx2 := MultiTransaction{
|
||||
Timestamp: 321,
|
||||
FromNetworkID: 1,
|
||||
ToNetworkID: 0,
|
||||
//Empty FromTxHash
|
||||
ToTxHash: common.Hash{6},
|
||||
FromAddress: common.Address{2},
|
||||
ToAddress: common.Address{1},
|
||||
FromAsset: "fromAsset",
|
||||
ToAsset: "toAsset",
|
||||
FromAmount: (*hexutil.Big)(big.NewInt(123)),
|
||||
ToAmount: (*hexutil.Big)(big.NewInt(234)),
|
||||
Type: MultiTransactionBridge,
|
||||
CrossTxID: "crossTxD2",
|
||||
}
|
||||
|
||||
trxs := []*MultiTransaction{&trx1, &trx2}
|
||||
|
||||
var err error
|
||||
ids := make([]MultiTransactionIDType, len(trxs))
|
||||
for i, trx := range trxs {
|
||||
ids[i], err = insertMultiTransaction(manager.db, trx)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, MultiTransactionIDType(i+1), ids[i])
|
||||
}
|
||||
|
||||
rst, err := manager.GetBridgeOriginMultiTransaction(context.Background(), trx1.ToNetworkID, trx1.CrossTxID)
|
||||
require.NoError(t, err)
|
||||
require.NotEmpty(t, rst)
|
||||
require.True(t, areMultiTransactionsEqual(&trx1, rst))
|
||||
|
||||
rst, err = manager.GetBridgeDestinationMultiTransaction(context.Background(), trx1.ToNetworkID, trx1.CrossTxID)
|
||||
require.NoError(t, err)
|
||||
require.Empty(t, rst)
|
||||
|
||||
rst, err = manager.GetBridgeOriginMultiTransaction(context.Background(), trx2.ToNetworkID, trx2.CrossTxID)
|
||||
require.NoError(t, err)
|
||||
require.Empty(t, rst)
|
||||
|
||||
rst, err = manager.GetBridgeDestinationMultiTransaction(context.Background(), trx2.ToNetworkID, trx2.CrossTxID)
|
||||
require.NoError(t, err)
|
||||
require.NotEmpty(t, rst)
|
||||
require.True(t, areMultiTransactionsEqual(&trx2, rst))
|
||||
}
|
||||
|
||||
func TestMultiTransactions(t *testing.T) {
|
||||
manager, stop := setupTestTransactionDB(t)
|
||||
defer stop()
|
||||
|
||||
trx1 := MultiTransaction{
|
||||
Timestamp: 123,
|
||||
FromNetworkID: 0,
|
||||
ToNetworkID: 1,
|
||||
FromTxHash: common.Hash{5},
|
||||
ToTxHash: common.Hash{6},
|
||||
FromAddress: common.Address{1},
|
||||
ToAddress: common.Address{2},
|
||||
FromAsset: "fromAsset",
|
||||
ToAsset: "toAsset",
|
||||
FromAmount: (*hexutil.Big)(big.NewInt(123)),
|
||||
ToAmount: (*hexutil.Big)(big.NewInt(234)),
|
||||
Type: MultiTransactionBridge,
|
||||
CrossTxID: "crossTxD",
|
||||
}
|
||||
trx2 := trx1
|
||||
trx2.FromAmount = (*hexutil.Big)(big.NewInt(456))
|
||||
trx2.ToAmount = (*hexutil.Big)(big.NewInt(567))
|
||||
|
||||
trxs := []*MultiTransaction{&trx1, &trx2}
|
||||
|
||||
var err error
|
||||
ids := make([]MultiTransactionIDType, 2)
|
||||
ids[0], err = insertMultiTransaction(manager.db, &trx1)
|
||||
ids := make([]MultiTransactionIDType, len(trxs))
|
||||
for i, trx := range trxs {
|
||||
ids[i], err = insertMultiTransaction(manager.db, trx)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, MultiTransactionIDType(1), ids[0])
|
||||
ids[1], err = insertMultiTransaction(manager.db, &trx2)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, MultiTransactionIDType(2), ids[1])
|
||||
require.Equal(t, MultiTransactionIDType(i+1), ids[i])
|
||||
}
|
||||
|
||||
rst, err := manager.GetMultiTransactions(context.Background(), []MultiTransactionIDType{ids[0], 555})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, len(rst))
|
||||
require.True(t, areMultiTransactionsEqual(trxs[0], rst[0]))
|
||||
|
||||
trx1.FromAmount = (*hexutil.Big)(big.NewInt(789))
|
||||
trx1.ToAmount = (*hexutil.Big)(big.NewInt(890))
|
||||
err = updateMultiTransaction(manager.db, &trx1)
|
||||
require.NoError(t, err)
|
||||
|
||||
rst, err = manager.GetMultiTransactions(context.Background(), ids)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 2, len(rst))
|
||||
require.Equal(t, len(ids), len(rst))
|
||||
|
||||
for _, id := range ids {
|
||||
for i, id := range ids {
|
||||
found := false
|
||||
for _, trx := range rst {
|
||||
found = found || id == MultiTransactionIDType(trx.ID)
|
||||
if id == MultiTransactionIDType(trx.ID) {
|
||||
found = true
|
||||
require.True(t, areMultiTransactionsEqual(trxs[i], trx))
|
||||
break
|
||||
}
|
||||
}
|
||||
require.True(t, found, "result contains transaction with id %d", id)
|
||||
}
|
||||
|
|
|
@ -636,7 +636,12 @@ func ReadReceipts(db ethdb.Reader, hash common.Hash, number uint64, config *para
|
|||
log.Error("Missing body but have receipt", "hash", hash, "number", number)
|
||||
return nil
|
||||
}
|
||||
if err := receipts.DeriveFields(config, hash, number, body.Transactions); err != nil {
|
||||
header := ReadHeader(db, hash, number)
|
||||
if header == nil {
|
||||
log.Error("Missing header but have receipt", "hash", hash, "number", number)
|
||||
return nil
|
||||
}
|
||||
if err := receipts.DeriveFields(config, hash, number, header.Time, header.BaseFee, body.Transactions); err != nil {
|
||||
log.Error("Failed to derive block receipts fields", "hash", hash, "number", number, "err", err)
|
||||
return nil
|
||||
}
|
||||
|
@ -673,6 +678,16 @@ type storedReceiptRLP struct {
|
|||
PostStateOrStatus []byte
|
||||
CumulativeGasUsed uint64
|
||||
Logs []*types.LogForStorage
|
||||
ContractAddress *common.Address `rlp:"optional"` // set on new versions if an Arbitrum tx type
|
||||
|
||||
// Remaining fields are declared to allow the receipt RLP to be parsed without errors.
|
||||
// However, they must not be used as they may not be populated correctly due to multiple receipt formats
|
||||
// being combined into a single list of optional fields which can be mistaken for each other.
|
||||
// DepositNonce (*uint64) from Regolith deposit tx receipts will be parsed into L1GasUsed
|
||||
L1GasUsed *big.Int `rlp:"optional"` // OVM legacy
|
||||
L1GasPrice *big.Int `rlp:"optional"` // OVM legacy
|
||||
L1Fee *big.Int `rlp:"optional"` // OVM legacy
|
||||
FeeScalar string `rlp:"optional"` // OVM legacy
|
||||
}
|
||||
|
||||
// ReceiptLogs is a barebone version of ReceiptForStorage which only keeps
|
||||
|
|
|
@ -3,7 +3,6 @@ package types
|
|||
import (
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
|
@ -13,6 +12,12 @@ import (
|
|||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
// Returns true if nonce checks should be skipped based on inner's isFake()
|
||||
// This also disables requiring that sender is an EOA and not a contract
|
||||
func (tx *Transaction) SkipAccountChecks() bool {
|
||||
return tx.inner.isFake()
|
||||
}
|
||||
|
||||
type fallbackError struct {
|
||||
}
|
||||
|
||||
|
@ -92,6 +97,7 @@ func (tx *ArbitrumUnsignedTx) value() *big.Int { return tx.Value }
|
|||
func (tx *ArbitrumUnsignedTx) nonce() uint64 { return tx.Nonce }
|
||||
func (tx *ArbitrumUnsignedTx) to() *common.Address { return tx.To }
|
||||
func (tx *ArbitrumUnsignedTx) isFake() bool { return false }
|
||||
func (tx *ArbitrumUnsignedTx) isSystemTx() bool { return false }
|
||||
|
||||
func (tx *ArbitrumUnsignedTx) rawSignatureValues() (v, r, s *big.Int) {
|
||||
return bigZero, bigZero, bigZero
|
||||
|
@ -101,6 +107,13 @@ func (tx *ArbitrumUnsignedTx) setSignatureValues(chainID, v, r, s *big.Int) {
|
|||
|
||||
}
|
||||
|
||||
func (tx *ArbitrumUnsignedTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int {
|
||||
if baseFee == nil {
|
||||
return dst.Set(tx.GasFeeCap)
|
||||
}
|
||||
return dst.Set(baseFee)
|
||||
}
|
||||
|
||||
type ArbitrumContractTx struct {
|
||||
ChainId *big.Int
|
||||
RequestId common.Hash
|
||||
|
@ -157,6 +170,14 @@ func (tx *ArbitrumContractTx) rawSignatureValues() (v, r, s *big.Int) {
|
|||
}
|
||||
func (tx *ArbitrumContractTx) setSignatureValues(chainID, v, r, s *big.Int) {}
|
||||
func (tx *ArbitrumContractTx) isFake() bool { return true }
|
||||
func (tx *ArbitrumContractTx) isSystemTx() bool { return false }
|
||||
|
||||
func (tx *ArbitrumContractTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int {
|
||||
if baseFee == nil {
|
||||
return dst.Set(tx.GasFeeCap)
|
||||
}
|
||||
return dst.Set(baseFee)
|
||||
}
|
||||
|
||||
type ArbitrumRetryTx struct {
|
||||
ChainId *big.Int
|
||||
|
@ -228,6 +249,14 @@ func (tx *ArbitrumRetryTx) rawSignatureValues() (v, r, s *big.Int) {
|
|||
}
|
||||
func (tx *ArbitrumRetryTx) setSignatureValues(chainID, v, r, s *big.Int) {}
|
||||
func (tx *ArbitrumRetryTx) isFake() bool { return true }
|
||||
func (tx *ArbitrumRetryTx) isSystemTx() bool { return false }
|
||||
|
||||
func (tx *ArbitrumRetryTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int {
|
||||
if baseFee == nil {
|
||||
return dst.Set(tx.GasFeeCap)
|
||||
}
|
||||
return dst.Set(baseFee)
|
||||
}
|
||||
|
||||
type ArbitrumSubmitRetryableTx struct {
|
||||
ChainId *big.Int
|
||||
|
@ -303,6 +332,14 @@ func (tx *ArbitrumSubmitRetryableTx) rawSignatureValues() (v, r, s *big.Int) {
|
|||
}
|
||||
func (tx *ArbitrumSubmitRetryableTx) setSignatureValues(chainID, v, r, s *big.Int) {}
|
||||
func (tx *ArbitrumSubmitRetryableTx) isFake() bool { return true }
|
||||
func (tx *ArbitrumSubmitRetryableTx) isSystemTx() bool { return false }
|
||||
|
||||
func (tx *ArbitrumSubmitRetryableTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int {
|
||||
if baseFee == nil {
|
||||
return dst.Set(tx.GasFeeCap)
|
||||
}
|
||||
return dst.Set(baseFee)
|
||||
}
|
||||
|
||||
func (tx *ArbitrumSubmitRetryableTx) data() []byte {
|
||||
var retryTo common.Address
|
||||
|
@ -375,6 +412,7 @@ func (d *ArbitrumDepositTx) value() *big.Int { return d.Value }
|
|||
func (d *ArbitrumDepositTx) nonce() uint64 { return 0 }
|
||||
func (d *ArbitrumDepositTx) to() *common.Address { return &d.To }
|
||||
func (d *ArbitrumDepositTx) isFake() bool { return true }
|
||||
func (d *ArbitrumDepositTx) isSystemTx() bool { return false }
|
||||
|
||||
func (d *ArbitrumDepositTx) rawSignatureValues() (v, r, s *big.Int) {
|
||||
return bigZero, bigZero, bigZero
|
||||
|
@ -384,6 +422,10 @@ func (d *ArbitrumDepositTx) setSignatureValues(chainID, v, r, s *big.Int) {
|
|||
|
||||
}
|
||||
|
||||
func (tx *ArbitrumDepositTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int {
|
||||
return dst.Set(bigZero)
|
||||
}
|
||||
|
||||
type ArbitrumInternalTx struct {
|
||||
ChainId *big.Int
|
||||
Data []byte
|
||||
|
@ -411,6 +453,7 @@ func (t *ArbitrumInternalTx) value() *big.Int { return common.Big0 }
|
|||
func (t *ArbitrumInternalTx) nonce() uint64 { return 0 }
|
||||
func (t *ArbitrumInternalTx) to() *common.Address { return &ArbosAddress }
|
||||
func (t *ArbitrumInternalTx) isFake() bool { return true }
|
||||
func (t *ArbitrumInternalTx) isSystemTx() bool { return false }
|
||||
|
||||
func (d *ArbitrumInternalTx) rawSignatureValues() (v, r, s *big.Int) {
|
||||
return bigZero, bigZero, bigZero
|
||||
|
@ -420,6 +463,10 @@ func (d *ArbitrumInternalTx) setSignatureValues(chainID, v, r, s *big.Int) {
|
|||
|
||||
}
|
||||
|
||||
func (tx *ArbitrumInternalTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int {
|
||||
return dst.Set(bigZero)
|
||||
}
|
||||
|
||||
type HeaderInfo struct {
|
||||
SendRoot common.Hash
|
||||
SendCount uint64
|
||||
|
@ -444,19 +491,16 @@ func (info HeaderInfo) UpdateHeaderWithInfo(header *Header) {
|
|||
header.Extra = info.extra()
|
||||
}
|
||||
|
||||
func DeserializeHeaderExtraInformation(header *Header) (HeaderInfo, error) {
|
||||
if header.BaseFee == nil || header.BaseFee.Sign() == 0 || len(header.Extra) == 0 {
|
||||
func DeserializeHeaderExtraInformation(header *Header) HeaderInfo {
|
||||
if header.BaseFee == nil || header.BaseFee.Sign() == 0 || len(header.Extra) != 32 || header.Difficulty.Cmp(common.Big1) != 0 {
|
||||
// imported blocks have no base fee
|
||||
// The genesis block doesn't have an ArbOS encoded extra field
|
||||
return HeaderInfo{}, nil
|
||||
}
|
||||
if len(header.Extra) != 32 {
|
||||
return HeaderInfo{}, fmt.Errorf("unexpected header extra field length %v", len(header.Extra))
|
||||
return HeaderInfo{}
|
||||
}
|
||||
extra := HeaderInfo{}
|
||||
copy(extra.SendRoot[:], header.Extra)
|
||||
extra.SendCount = binary.BigEndian.Uint64(header.MixDigest[:8])
|
||||
extra.L1BlockNumber = binary.BigEndian.Uint64(header.MixDigest[8:16])
|
||||
extra.ArbOSFormatVersion = binary.BigEndian.Uint64(header.MixDigest[16:24])
|
||||
return extra, nil
|
||||
return extra
|
||||
}
|
||||
|
|
|
@ -31,11 +31,6 @@ import (
|
|||
"github.com/ethereum/go-ethereum/rlp"
|
||||
)
|
||||
|
||||
var (
|
||||
EmptyRootHash = common.HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")
|
||||
EmptyUncleHash = rlpHash([]*Header(nil))
|
||||
)
|
||||
|
||||
// A BlockNonce is a 64-bit hash which proves (combined with the
|
||||
// mix-hash) that a sufficient amount of computation has been carried
|
||||
// out on a block.
|
||||
|
@ -87,6 +82,12 @@ type Header struct {
|
|||
// BaseFee was added by EIP-1559 and is ignored in legacy headers.
|
||||
BaseFee *big.Int `json:"baseFeePerGas" rlp:"optional"`
|
||||
|
||||
// WithdrawalsHash was added by EIP-4895 and is ignored in legacy headers.
|
||||
WithdrawalsHash *common.Hash `json:"withdrawalsRoot" rlp:"optional"`
|
||||
|
||||
// ExcessDataGas was added by EIP-4844 and is ignored in legacy headers.
|
||||
ExcessDataGas *big.Int `json:"excessDataGas" rlp:"optional"`
|
||||
|
||||
/*
|
||||
TODO (MariusVanDerWijden) Add this field once needed
|
||||
// Random was added during the merge and contains the BeaconState randomness
|
||||
|
@ -149,14 +150,17 @@ func (h *Header) SanityCheck() error {
|
|||
}
|
||||
|
||||
// EmptyBody returns true if there is no additional 'body' to complete the header
|
||||
// that is: no transactions and no uncles.
|
||||
// that is: no transactions, no uncles and no withdrawals.
|
||||
func (h *Header) EmptyBody() bool {
|
||||
return h.TxHash == EmptyRootHash && h.UncleHash == EmptyUncleHash
|
||||
if h.WithdrawalsHash == nil {
|
||||
return h.TxHash == EmptyTxsHash && h.UncleHash == EmptyUncleHash
|
||||
}
|
||||
return h.TxHash == EmptyTxsHash && h.UncleHash == EmptyUncleHash && *h.WithdrawalsHash == EmptyWithdrawalsHash
|
||||
}
|
||||
|
||||
// EmptyReceipts returns true if there are no receipts for this header/block.
|
||||
func (h *Header) EmptyReceipts() bool {
|
||||
return h.ReceiptHash == EmptyRootHash
|
||||
return h.ReceiptHash == EmptyReceiptsHash
|
||||
}
|
||||
|
||||
// Body is a simple (mutable, non-safe) data container for storing and moving
|
||||
|
@ -164,6 +168,7 @@ func (h *Header) EmptyReceipts() bool {
|
|||
type Body struct {
|
||||
Transactions []*Transaction
|
||||
Uncles []*Header
|
||||
Withdrawals []*Withdrawal `rlp:"optional"`
|
||||
}
|
||||
|
||||
// Block represents an entire block in the Ethereum blockchain.
|
||||
|
@ -171,6 +176,7 @@ type Block struct {
|
|||
header *Header
|
||||
uncles []*Header
|
||||
transactions Transactions
|
||||
withdrawals Withdrawals
|
||||
|
||||
// caches
|
||||
hash atomic.Value
|
||||
|
@ -187,6 +193,7 @@ type extblock struct {
|
|||
Header *Header
|
||||
Txs []*Transaction
|
||||
Uncles []*Header
|
||||
Withdrawals []*Withdrawal `rlp:"optional"`
|
||||
}
|
||||
|
||||
// NewBlock creates a new block. The input data is copied,
|
||||
|
@ -201,7 +208,7 @@ func NewBlock(header *Header, txs []*Transaction, uncles []*Header, receipts []*
|
|||
|
||||
// TODO: panic if len(txs) != len(receipts)
|
||||
if len(txs) == 0 {
|
||||
b.header.TxHash = EmptyRootHash
|
||||
b.header.TxHash = EmptyTxsHash
|
||||
} else {
|
||||
b.header.TxHash = DeriveSha(Transactions(txs), hasher)
|
||||
b.transactions = make(Transactions, len(txs))
|
||||
|
@ -209,7 +216,7 @@ func NewBlock(header *Header, txs []*Transaction, uncles []*Header, receipts []*
|
|||
}
|
||||
|
||||
if len(receipts) == 0 {
|
||||
b.header.ReceiptHash = EmptyRootHash
|
||||
b.header.ReceiptHash = EmptyReceiptsHash
|
||||
} else {
|
||||
b.header.ReceiptHash = DeriveSha(Receipts(receipts), hasher)
|
||||
b.header.Bloom = CreateBloom(receipts)
|
||||
|
@ -228,6 +235,28 @@ func NewBlock(header *Header, txs []*Transaction, uncles []*Header, receipts []*
|
|||
return b
|
||||
}
|
||||
|
||||
// NewBlockWithWithdrawals creates a new block with withdrawals. The input data
|
||||
// is copied, changes to header and to the field values will not
|
||||
// affect the block.
|
||||
//
|
||||
// The values of TxHash, UncleHash, ReceiptHash and Bloom in header
|
||||
// are ignored and set to values derived from the given txs, uncles
|
||||
// and receipts.
|
||||
func NewBlockWithWithdrawals(header *Header, txs []*Transaction, uncles []*Header, receipts []*Receipt, withdrawals []*Withdrawal, hasher TrieHasher) *Block {
|
||||
b := NewBlock(header, txs, uncles, receipts, hasher)
|
||||
|
||||
if withdrawals == nil {
|
||||
b.header.WithdrawalsHash = nil
|
||||
} else if len(withdrawals) == 0 {
|
||||
b.header.WithdrawalsHash = &EmptyWithdrawalsHash
|
||||
} else {
|
||||
h := DeriveSha(Withdrawals(withdrawals), hasher)
|
||||
b.header.WithdrawalsHash = &h
|
||||
}
|
||||
|
||||
return b.WithWithdrawals(withdrawals)
|
||||
}
|
||||
|
||||
// NewBlockWithHeader creates a block with the given header data. The
|
||||
// header data is copied, changes to header and to the field values
|
||||
// will not affect the block.
|
||||
|
@ -252,6 +281,10 @@ func CopyHeader(h *Header) *Header {
|
|||
cpy.Extra = make([]byte, len(h.Extra))
|
||||
copy(cpy.Extra, h.Extra)
|
||||
}
|
||||
if h.WithdrawalsHash != nil {
|
||||
cpy.WithdrawalsHash = new(common.Hash)
|
||||
*cpy.WithdrawalsHash = *h.WithdrawalsHash
|
||||
}
|
||||
return &cpy
|
||||
}
|
||||
|
||||
|
@ -262,8 +295,8 @@ func (b *Block) DecodeRLP(s *rlp.Stream) error {
|
|||
if err := s.Decode(&eb); err != nil {
|
||||
return err
|
||||
}
|
||||
b.header, b.uncles, b.transactions = eb.Header, eb.Uncles, eb.Txs
|
||||
b.size.Store(common.StorageSize(rlp.ListSize(size)))
|
||||
b.header, b.uncles, b.transactions, b.withdrawals = eb.Header, eb.Uncles, eb.Txs, eb.Withdrawals
|
||||
b.size.Store(rlp.ListSize(size))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -273,6 +306,7 @@ func (b *Block) EncodeRLP(w io.Writer) error {
|
|||
Header: b.header,
|
||||
Txs: b.transactions,
|
||||
Uncles: b.uncles,
|
||||
Withdrawals: b.withdrawals,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -315,10 +349,14 @@ func (b *Block) BaseFee() *big.Int {
|
|||
return new(big.Int).Set(b.header.BaseFee)
|
||||
}
|
||||
|
||||
func (b *Block) Withdrawals() Withdrawals {
|
||||
return b.withdrawals
|
||||
}
|
||||
|
||||
func (b *Block) Header() *Header { return CopyHeader(b.header) }
|
||||
|
||||
// Body returns the non-header content of the block.
|
||||
func (b *Block) Body() *Body { return &Body{b.transactions, b.uncles} }
|
||||
func (b *Block) Body() *Body { return &Body{b.transactions, b.uncles, b.withdrawals} }
|
||||
|
||||
// Size returns the true RLP encoded storage size of the block, either by encoding
|
||||
// and returning it, or returning a previously cached value.
|
||||
|
@ -338,7 +376,7 @@ func (b *Block) SanityCheck() error {
|
|||
return b.header.SanityCheck()
|
||||
}
|
||||
|
||||
type writeCounter common.StorageSize
|
||||
type writeCounter uint64
|
||||
|
||||
func (c *writeCounter) Write(b []byte) (int, error) {
|
||||
*c += writeCounter(len(b))
|
||||
|
@ -361,6 +399,7 @@ func (b *Block) WithSeal(header *Header) *Block {
|
|||
header: &cpy,
|
||||
transactions: b.transactions,
|
||||
uncles: b.uncles,
|
||||
withdrawals: b.withdrawals,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -378,6 +417,15 @@ func (b *Block) WithBody(transactions []*Transaction, uncles []*Header) *Block {
|
|||
return block
|
||||
}
|
||||
|
||||
// WithWithdrawals sets the withdrawal contents of a block, does not return a new block.
|
||||
func (b *Block) WithWithdrawals(withdrawals []*Withdrawal) *Block {
|
||||
if withdrawals != nil {
|
||||
b.withdrawals = make([]*Withdrawal, len(withdrawals))
|
||||
copy(b.withdrawals, withdrawals)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// Hash returns the keccak256 hash of b's header.
|
||||
// The hash is computed on the first call and cached thereafter.
|
||||
func (b *Block) Hash() common.Hash {
|
||||
|
|
|
@ -32,6 +32,7 @@ func (h Header) MarshalJSON() ([]byte, error) {
|
|||
MixDigest common.Hash `json:"mixHash"`
|
||||
Nonce BlockNonce `json:"nonce"`
|
||||
BaseFee *hexutil.Big `json:"baseFeePerGas" rlp:"optional"`
|
||||
WithdrawalsHash *common.Hash `json:"withdrawalsRoot" rlp:"optional"`
|
||||
Hash common.Hash `json:"hash"`
|
||||
}
|
||||
var enc Header
|
||||
|
@ -51,6 +52,7 @@ func (h Header) MarshalJSON() ([]byte, error) {
|
|||
enc.MixDigest = h.MixDigest
|
||||
enc.Nonce = h.Nonce
|
||||
enc.BaseFee = (*hexutil.Big)(h.BaseFee)
|
||||
enc.WithdrawalsHash = h.WithdrawalsHash
|
||||
enc.Hash = h.Hash()
|
||||
return json.Marshal(&enc)
|
||||
}
|
||||
|
@ -74,6 +76,7 @@ func (h *Header) UnmarshalJSON(input []byte) error {
|
|||
MixDigest *common.Hash `json:"mixHash"`
|
||||
Nonce *BlockNonce `json:"nonce"`
|
||||
BaseFee *hexutil.Big `json:"baseFeePerGas" rlp:"optional"`
|
||||
WithdrawalsHash *common.Hash `json:"withdrawalsRoot" rlp:"optional"`
|
||||
}
|
||||
var dec Header
|
||||
if err := json.Unmarshal(input, &dec); err != nil {
|
||||
|
@ -139,5 +142,8 @@ func (h *Header) UnmarshalJSON(input []byte) error {
|
|||
if dec.BaseFee != nil {
|
||||
h.BaseFee = (*big.Int)(dec.BaseFee)
|
||||
}
|
||||
if dec.WithdrawalsHash != nil {
|
||||
h.WithdrawalsHash = dec.WithdrawalsHash
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -41,7 +41,8 @@ func (obj *Header) EncodeRLP(_w io.Writer) error {
|
|||
w.WriteBytes(obj.MixDigest[:])
|
||||
w.WriteBytes(obj.Nonce[:])
|
||||
_tmp1 := obj.BaseFee != nil
|
||||
if _tmp1 {
|
||||
_tmp2 := obj.WithdrawalsHash != nil
|
||||
if _tmp1 || _tmp2 {
|
||||
if obj.BaseFee == nil {
|
||||
w.Write(rlp.EmptyString)
|
||||
} else {
|
||||
|
@ -51,6 +52,13 @@ func (obj *Header) EncodeRLP(_w io.Writer) error {
|
|||
w.WriteBigInt(obj.BaseFee)
|
||||
}
|
||||
}
|
||||
if _tmp2 {
|
||||
if obj.WithdrawalsHash == nil {
|
||||
w.Write([]byte{0x80})
|
||||
} else {
|
||||
w.WriteBytes(obj.WithdrawalsHash[:])
|
||||
}
|
||||
}
|
||||
w.ListEnd(_tmp0)
|
||||
return w.Flush()
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ var _ = (*receiptMarshaling)(nil)
|
|||
// MarshalJSON marshals as JSON.
|
||||
func (r Receipt) MarshalJSON() ([]byte, error) {
|
||||
type Receipt struct {
|
||||
GasUsedForL1 hexutil.Uint64 `json:"gasUsedForL1,omitempty"`
|
||||
Type hexutil.Uint64 `json:"type,omitempty"`
|
||||
PostState hexutil.Bytes `json:"root"`
|
||||
Status hexutil.Uint64 `json:"status"`
|
||||
|
@ -25,11 +26,17 @@ func (r Receipt) MarshalJSON() ([]byte, error) {
|
|||
TxHash common.Hash `json:"transactionHash" gencodec:"required"`
|
||||
ContractAddress common.Address `json:"contractAddress"`
|
||||
GasUsed hexutil.Uint64 `json:"gasUsed" gencodec:"required"`
|
||||
EffectiveGasPrice *hexutil.Big `json:"effectiveGasPrice,omitempty"`
|
||||
BlockHash common.Hash `json:"blockHash,omitempty"`
|
||||
BlockNumber *hexutil.Big `json:"blockNumber,omitempty"`
|
||||
TransactionIndex hexutil.Uint `json:"transactionIndex"`
|
||||
L1GasPrice *hexutil.Big `json:"l1GasPrice,omitempty"`
|
||||
L1GasUsed *hexutil.Big `json:"l1GasUsed,omitempty"`
|
||||
L1Fee *hexutil.Big `json:"l1Fee,omitempty"`
|
||||
FeeScalar *big.Float `json:"l1FeeScalar,omitempty"`
|
||||
}
|
||||
var enc Receipt
|
||||
enc.GasUsedForL1 = hexutil.Uint64(r.GasUsedForL1)
|
||||
enc.Type = hexutil.Uint64(r.Type)
|
||||
enc.PostState = r.PostState
|
||||
enc.Status = hexutil.Uint64(r.Status)
|
||||
|
@ -39,15 +46,21 @@ func (r Receipt) MarshalJSON() ([]byte, error) {
|
|||
enc.TxHash = r.TxHash
|
||||
enc.ContractAddress = r.ContractAddress
|
||||
enc.GasUsed = hexutil.Uint64(r.GasUsed)
|
||||
enc.EffectiveGasPrice = (*hexutil.Big)(r.EffectiveGasPrice)
|
||||
enc.BlockHash = r.BlockHash
|
||||
enc.BlockNumber = (*hexutil.Big)(r.BlockNumber)
|
||||
enc.TransactionIndex = hexutil.Uint(r.TransactionIndex)
|
||||
enc.L1GasPrice = (*hexutil.Big)(r.L1GasPrice)
|
||||
enc.L1GasUsed = (*hexutil.Big)(r.L1GasUsed)
|
||||
enc.L1Fee = (*hexutil.Big)(r.L1Fee)
|
||||
enc.FeeScalar = r.FeeScalar
|
||||
return json.Marshal(&enc)
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshals from JSON.
|
||||
func (r *Receipt) UnmarshalJSON(input []byte) error {
|
||||
type Receipt struct {
|
||||
GasUsedForL1 *hexutil.Uint64 `json:"gasUsedForL1,omitempty"`
|
||||
Type *hexutil.Uint64 `json:"type,omitempty"`
|
||||
PostState *hexutil.Bytes `json:"root"`
|
||||
Status *hexutil.Uint64 `json:"status"`
|
||||
|
@ -57,14 +70,23 @@ func (r *Receipt) UnmarshalJSON(input []byte) error {
|
|||
TxHash *common.Hash `json:"transactionHash" gencodec:"required"`
|
||||
ContractAddress *common.Address `json:"contractAddress"`
|
||||
GasUsed *hexutil.Uint64 `json:"gasUsed" gencodec:"required"`
|
||||
EffectiveGasPrice *hexutil.Big `json:"effectiveGasPrice,omitempty"`
|
||||
BlockHash *common.Hash `json:"blockHash,omitempty"`
|
||||
BlockNumber *hexutil.Big `json:"blockNumber,omitempty"`
|
||||
TransactionIndex *hexutil.Uint `json:"transactionIndex"`
|
||||
L1GasPrice *hexutil.Big `json:"l1GasPrice,omitempty"`
|
||||
L1GasUsed *hexutil.Big `json:"l1GasUsed,omitempty"`
|
||||
L1Fee *hexutil.Big `json:"l1Fee,omitempty"`
|
||||
FeeScalar *big.Float `json:"l1FeeScalar,omitempty"`
|
||||
DepositNonce *hexutil.Uint64 `json:"depositNonce,omitempty"`
|
||||
}
|
||||
var dec Receipt
|
||||
if err := json.Unmarshal(input, &dec); err != nil {
|
||||
return err
|
||||
}
|
||||
if dec.GasUsedForL1 != nil {
|
||||
r.GasUsedForL1 = uint64(*dec.GasUsedForL1)
|
||||
}
|
||||
if dec.Type != nil {
|
||||
r.Type = uint8(*dec.Type)
|
||||
}
|
||||
|
@ -97,6 +119,9 @@ func (r *Receipt) UnmarshalJSON(input []byte) error {
|
|||
return errors.New("missing required field 'gasUsed' for Receipt")
|
||||
}
|
||||
r.GasUsed = uint64(*dec.GasUsed)
|
||||
if dec.EffectiveGasPrice != nil {
|
||||
r.EffectiveGasPrice = (*big.Int)(dec.EffectiveGasPrice)
|
||||
}
|
||||
if dec.BlockHash != nil {
|
||||
r.BlockHash = *dec.BlockHash
|
||||
}
|
||||
|
@ -106,5 +131,20 @@ func (r *Receipt) UnmarshalJSON(input []byte) error {
|
|||
if dec.TransactionIndex != nil {
|
||||
r.TransactionIndex = uint(*dec.TransactionIndex)
|
||||
}
|
||||
if dec.L1GasPrice != nil {
|
||||
r.L1GasPrice = (*big.Int)(dec.L1GasPrice)
|
||||
}
|
||||
if dec.L1GasUsed != nil {
|
||||
r.L1GasUsed = (*big.Int)(dec.L1GasUsed)
|
||||
}
|
||||
if dec.L1Fee != nil {
|
||||
r.L1Fee = (*big.Int)(dec.L1Fee)
|
||||
}
|
||||
if dec.FeeScalar != nil {
|
||||
r.FeeScalar = dec.FeeScalar
|
||||
}
|
||||
if dec.DepositNonce != nil {
|
||||
r.DepositNonce = (*uint64)(dec.DepositNonce)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
55
vendor/github.com/ethereum/go-ethereum/core/types/gen_withdrawal_json.go
generated
vendored
Normal file
55
vendor/github.com/ethereum/go-ethereum/core/types/gen_withdrawal_json.go
generated
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
)
|
||||
|
||||
var _ = (*withdrawalMarshaling)(nil)
|
||||
|
||||
// MarshalJSON marshals as JSON.
|
||||
func (w Withdrawal) MarshalJSON() ([]byte, error) {
|
||||
type Withdrawal struct {
|
||||
Index hexutil.Uint64 `json:"index"`
|
||||
Validator hexutil.Uint64 `json:"validatorIndex"`
|
||||
Address common.Address `json:"address"`
|
||||
Amount hexutil.Uint64 `json:"amount"`
|
||||
}
|
||||
var enc Withdrawal
|
||||
enc.Index = hexutil.Uint64(w.Index)
|
||||
enc.Validator = hexutil.Uint64(w.Validator)
|
||||
enc.Address = w.Address
|
||||
enc.Amount = hexutil.Uint64(w.Amount)
|
||||
return json.Marshal(&enc)
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshals from JSON.
|
||||
func (w *Withdrawal) UnmarshalJSON(input []byte) error {
|
||||
type Withdrawal struct {
|
||||
Index *hexutil.Uint64 `json:"index"`
|
||||
Validator *hexutil.Uint64 `json:"validatorIndex"`
|
||||
Address *common.Address `json:"address"`
|
||||
Amount *hexutil.Uint64 `json:"amount"`
|
||||
}
|
||||
var dec Withdrawal
|
||||
if err := json.Unmarshal(input, &dec); err != nil {
|
||||
return err
|
||||
}
|
||||
if dec.Index != nil {
|
||||
w.Index = uint64(*dec.Index)
|
||||
}
|
||||
if dec.Validator != nil {
|
||||
w.Validator = uint64(*dec.Validator)
|
||||
}
|
||||
if dec.Address != nil {
|
||||
w.Address = *dec.Address
|
||||
}
|
||||
if dec.Amount != nil {
|
||||
w.Amount = uint64(*dec.Amount)
|
||||
}
|
||||
return nil
|
||||
}
|
20
vendor/github.com/ethereum/go-ethereum/core/types/gen_withdrawal_rlp.go
generated
vendored
Normal file
20
vendor/github.com/ethereum/go-ethereum/core/types/gen_withdrawal_rlp.go
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
// Code generated by rlpgen. DO NOT EDIT.
|
||||
|
||||
//go:build !norlpgen
|
||||
// +build !norlpgen
|
||||
|
||||
package types
|
||||
|
||||
import "github.com/ethereum/go-ethereum/rlp"
|
||||
import "io"
|
||||
|
||||
func (obj *Withdrawal) EncodeRLP(_w io.Writer) error {
|
||||
w := rlp.NewEncoderBuffer(_w)
|
||||
_tmp0 := w.List()
|
||||
w.WriteUint64(obj.Index)
|
||||
w.WriteUint64(obj.Validator)
|
||||
w.WriteBytes(obj.Address[:])
|
||||
w.WriteUint64(obj.Amount)
|
||||
w.ListEnd(_tmp0)
|
||||
return w.Flush()
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
// Copyright 2023 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
)
|
||||
|
||||
var (
|
||||
// EmptyRootHash is the known root hash of an empty trie.
|
||||
EmptyRootHash = common.HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")
|
||||
|
||||
// EmptyUncleHash is the known hash of the empty uncle set.
|
||||
EmptyUncleHash = rlpHash([]*Header(nil)) // 1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347
|
||||
|
||||
// EmptyCodeHash is the known hash of the empty EVM bytecode.
|
||||
EmptyCodeHash = crypto.Keccak256Hash(nil) // c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470
|
||||
|
||||
// EmptyTxsHash is the known hash of the empty transaction set.
|
||||
EmptyTxsHash = common.HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")
|
||||
|
||||
// EmptyReceiptsHash is the known hash of the empty receipt set.
|
||||
EmptyReceiptsHash = common.HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")
|
||||
|
||||
// EmptyWithdrawalsHash is the known hash of the empty withdrawal set.
|
||||
EmptyWithdrawalsHash = common.HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")
|
||||
)
|
|
@ -1,53 +0,0 @@
|
|||
// Copyright 2022 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
)
|
||||
|
||||
// IsLegacyStoredReceipts tries to parse the RLP-encoded blob
|
||||
// first as an array of v3 stored receipt, then v4 stored receipt and
|
||||
// returns true if successful.
|
||||
func IsLegacyStoredReceipts(raw []byte) (bool, error) {
|
||||
var v3 []v3StoredReceiptRLP
|
||||
if err := rlp.DecodeBytes(raw, &v3); err == nil {
|
||||
return true, nil
|
||||
}
|
||||
var v4 []v4StoredReceiptRLP
|
||||
if err := rlp.DecodeBytes(raw, &v4); err == nil {
|
||||
return true, nil
|
||||
}
|
||||
var v5 []storedReceiptRLP
|
||||
// Check to see valid fresh stored receipt
|
||||
if err := rlp.DecodeBytes(raw, &v5); err == nil {
|
||||
return false, nil
|
||||
}
|
||||
return false, errors.New("value is not a valid receipt encoding")
|
||||
}
|
||||
|
||||
// ConvertLegacyStoredReceipts takes the RLP encoding of an array of legacy
|
||||
// stored receipts and returns a fresh RLP-encoded stored receipt.
|
||||
func ConvertLegacyStoredReceipts(raw []byte) ([]byte, error) {
|
||||
var receipts []ReceiptForStorage
|
||||
if err := rlp.DecodeBytes(raw, &receipts); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rlp.EncodeToBytes(&receipts)
|
||||
}
|
|
@ -64,24 +64,13 @@ type logMarshaling struct {
|
|||
|
||||
//go:generate go run ../../rlp/rlpgen -type rlpLog -out gen_log_rlp.go
|
||||
|
||||
// rlpLog is used to RLP-encode both the consensus and storage formats.
|
||||
type rlpLog struct {
|
||||
Address common.Address
|
||||
Topics []common.Hash
|
||||
Data []byte
|
||||
}
|
||||
|
||||
// legacyRlpStorageLog is the previous storage encoding of a log including some redundant fields.
|
||||
type legacyRlpStorageLog struct {
|
||||
Address common.Address
|
||||
Topics []common.Hash
|
||||
Data []byte
|
||||
BlockNumber uint64
|
||||
TxHash common.Hash
|
||||
TxIndex uint
|
||||
BlockHash common.Hash
|
||||
Index uint
|
||||
}
|
||||
|
||||
// EncodeRLP implements rlp.Encoder.
|
||||
func (l *Log) EncodeRLP(w io.Writer) error {
|
||||
rl := rlpLog{Address: l.Address, Topics: l.Topics, Data: l.Data}
|
||||
|
@ -97,44 +86,3 @@ func (l *Log) DecodeRLP(s *rlp.Stream) error {
|
|||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// LogForStorage is a wrapper around a Log that handles
|
||||
// backward compatibility with prior storage formats.
|
||||
type LogForStorage Log
|
||||
|
||||
// EncodeRLP implements rlp.Encoder.
|
||||
func (l *LogForStorage) EncodeRLP(w io.Writer) error {
|
||||
rl := rlpLog{Address: l.Address, Topics: l.Topics, Data: l.Data}
|
||||
return rlp.Encode(w, &rl)
|
||||
}
|
||||
|
||||
// DecodeRLP implements rlp.Decoder.
|
||||
//
|
||||
// Note some redundant fields(e.g. block number, tx hash etc) will be assembled later.
|
||||
func (l *LogForStorage) DecodeRLP(s *rlp.Stream) error {
|
||||
blob, err := s.Raw()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var dec rlpLog
|
||||
err = rlp.DecodeBytes(blob, &dec)
|
||||
if err == nil {
|
||||
*l = LogForStorage{
|
||||
Address: dec.Address,
|
||||
Topics: dec.Topics,
|
||||
Data: dec.Data,
|
||||
}
|
||||
} else {
|
||||
// Try to decode log with previous definition.
|
||||
var dec legacyRlpStorageLog
|
||||
err = rlp.DecodeBytes(blob, &dec)
|
||||
if err == nil {
|
||||
*l = LogForStorage{
|
||||
Address: dec.Address,
|
||||
Topics: dec.Topics,
|
||||
Data: dec.Data,
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
package types
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
type OptimismDepositTx struct {
|
||||
ChainID *big.Int
|
||||
From common.Address
|
||||
To common.Address
|
||||
Mint *big.Int
|
||||
Value *big.Int
|
||||
Data []byte
|
||||
GasLimit uint64
|
||||
}
|
||||
|
||||
func (d *OptimismDepositTx) txType() byte {
|
||||
return OptimismDepositTxType
|
||||
}
|
||||
|
||||
func (d *OptimismDepositTx) copy() TxData {
|
||||
tx := &OptimismDepositTx{
|
||||
From: d.From,
|
||||
To: d.To,
|
||||
Mint: new(big.Int),
|
||||
Value: new(big.Int),
|
||||
ChainID: new(big.Int),
|
||||
Data: d.Data,
|
||||
GasLimit: d.GasLimit,
|
||||
}
|
||||
if d.Value != nil {
|
||||
tx.Value.Set(d.Value)
|
||||
}
|
||||
|
||||
if d.ChainID != nil {
|
||||
tx.Value.Set(d.ChainID)
|
||||
}
|
||||
|
||||
if d.Mint != nil {
|
||||
tx.Value.Set(d.Mint)
|
||||
}
|
||||
return tx
|
||||
}
|
||||
|
||||
func (d *OptimismDepositTx) chainID() *big.Int { return d.ChainID }
|
||||
func (d *OptimismDepositTx) accessList() AccessList { return nil }
|
||||
func (d *OptimismDepositTx) data() []byte { return nil }
|
||||
func (d *OptimismDepositTx) gas() uint64 { return 0 }
|
||||
func (d *OptimismDepositTx) gasPrice() *big.Int { return bigZero }
|
||||
func (d *OptimismDepositTx) gasTipCap() *big.Int { return bigZero }
|
||||
func (d *OptimismDepositTx) gasFeeCap() *big.Int { return bigZero }
|
||||
func (d *OptimismDepositTx) value() *big.Int { return d.Value }
|
||||
func (d *OptimismDepositTx) nonce() uint64 { return 0 }
|
||||
func (d *OptimismDepositTx) to() *common.Address { return &d.To }
|
||||
func (d *OptimismDepositTx) isFake() bool { return true }
|
||||
|
||||
func (d *OptimismDepositTx) rawSignatureValues() (v, r, s *big.Int) {
|
||||
return bigZero, bigZero, bigZero
|
||||
}
|
||||
|
||||
func (d *OptimismDepositTx) setSignatureValues(chainID, v, r, s *big.Int) {
|
||||
|
||||
}
|
92
vendor/github.com/ethereum/go-ethereum/core/types/optimism_deposit_tx.go
generated
vendored
Normal file
92
vendor/github.com/ethereum/go-ethereum/core/types/optimism_deposit_tx.go
generated
vendored
Normal file
|
@ -0,0 +1,92 @@
|
|||
// Copyright 2021 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
type OptimismDepositTx struct {
|
||||
// SourceHash uniquely identifies the source of the deposit
|
||||
SourceHash common.Hash
|
||||
// From is exposed through the types.Signer, not through TxData
|
||||
From common.Address
|
||||
// nil means contract creation
|
||||
To *common.Address `rlp:"nil"`
|
||||
// Mint is minted on L2, locked on L1, nil if no minting.
|
||||
Mint *big.Int `rlp:"nil"`
|
||||
// Value is transferred from L2 balance, executed after Mint (if any)
|
||||
Value *big.Int
|
||||
// gas limit
|
||||
Gas uint64
|
||||
// Field indicating if this transaction is exempt from the L2 gas limit.
|
||||
IsSystemTransaction bool
|
||||
// Normal Tx data
|
||||
Data []byte
|
||||
}
|
||||
|
||||
// copy creates a deep copy of the transaction data and initializes all fields.
|
||||
func (tx *OptimismDepositTx) copy() TxData {
|
||||
cpy := &OptimismDepositTx{
|
||||
SourceHash: tx.SourceHash,
|
||||
From: tx.From,
|
||||
To: copyAddressPtr(tx.To),
|
||||
Mint: nil,
|
||||
Value: new(big.Int),
|
||||
Gas: tx.Gas,
|
||||
IsSystemTransaction: tx.IsSystemTransaction,
|
||||
Data: common.CopyBytes(tx.Data),
|
||||
}
|
||||
if tx.Mint != nil {
|
||||
cpy.Mint = new(big.Int).Set(tx.Mint)
|
||||
}
|
||||
if tx.Value != nil {
|
||||
cpy.Value.Set(tx.Value)
|
||||
}
|
||||
return cpy
|
||||
}
|
||||
|
||||
// accessors for innerTx.
|
||||
func (tx *OptimismDepositTx) txType() byte { return OptimismDepositTxType }
|
||||
func (tx *OptimismDepositTx) chainID() *big.Int { return common.Big0 }
|
||||
func (tx *OptimismDepositTx) accessList() AccessList { return nil }
|
||||
func (tx *OptimismDepositTx) data() []byte { return tx.Data }
|
||||
func (tx *OptimismDepositTx) gas() uint64 { return tx.Gas }
|
||||
func (tx *OptimismDepositTx) gasFeeCap() *big.Int { return new(big.Int) }
|
||||
func (tx *OptimismDepositTx) gasTipCap() *big.Int { return new(big.Int) }
|
||||
func (tx *OptimismDepositTx) gasPrice() *big.Int { return new(big.Int) }
|
||||
func (tx *OptimismDepositTx) value() *big.Int { return tx.Value }
|
||||
func (tx *OptimismDepositTx) nonce() uint64 { return 0 }
|
||||
func (tx *OptimismDepositTx) to() *common.Address { return tx.To }
|
||||
func (tx *OptimismDepositTx) isFake() bool { return true }
|
||||
func (tx *OptimismDepositTx) isSystemTx() bool { return tx.IsSystemTransaction }
|
||||
|
||||
func (tx *OptimismDepositTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int {
|
||||
return dst.Set(new(big.Int))
|
||||
}
|
||||
|
||||
func (tx *OptimismDepositTx) effectiveNonce() *uint64 { return nil }
|
||||
|
||||
func (tx *OptimismDepositTx) rawSignatureValues() (v, r, s *big.Int) {
|
||||
return common.Big0, common.Big0, common.Big0
|
||||
}
|
||||
|
||||
func (tx *OptimismDepositTx) setSignatureValues(chainID, v, r, s *big.Int) {
|
||||
// this is a noop for deposit transactions
|
||||
}
|
|
@ -36,6 +36,7 @@ import (
|
|||
var (
|
||||
receiptStatusFailedRLP = []byte{}
|
||||
receiptStatusSuccessfulRLP = []byte{0x01}
|
||||
receiptRootArbitrumLegacy = []byte{0x00}
|
||||
)
|
||||
|
||||
var errShortTypedReceipt = errors.New("typed receipt too short")
|
||||
|
@ -50,6 +51,9 @@ const (
|
|||
|
||||
// Receipt represents the results of a transaction.
|
||||
type Receipt struct {
|
||||
// Arbitrum Implementation fields
|
||||
GasUsedForL1 uint64 `json:"gasUsedForL1,omitempty"`
|
||||
|
||||
// Consensus fields: These fields are defined by the Yellow Paper
|
||||
Type uint8 `json:"type,omitempty"`
|
||||
PostState []byte `json:"root"`
|
||||
|
@ -58,20 +62,34 @@ type Receipt struct {
|
|||
Bloom Bloom `json:"logsBloom" gencodec:"required"`
|
||||
Logs []*Log `json:"logs" gencodec:"required"`
|
||||
|
||||
// Implementation fields: These fields are added by geth when processing a transaction.
|
||||
// They are stored in the chain database.
|
||||
// Implementation fields: These fields are added by geth when processing a transaction or retrieving a receipt.
|
||||
// gencodec annotated fields: these are stored in the chain database.
|
||||
TxHash common.Hash `json:"transactionHash" gencodec:"required"`
|
||||
ContractAddress common.Address `json:"contractAddress"`
|
||||
GasUsed uint64 `json:"gasUsed" gencodec:"required"`
|
||||
EffectiveGasPrice *big.Int `json:"effectiveGasPrice"`
|
||||
|
||||
// DepositNonce was introduced in Regolith to store the actual nonce used by deposit transactions
|
||||
// The state transition process ensures this is only set for Regolith deposit transactions.
|
||||
DepositNonce *uint64 `json:"depositNonce,omitempty"`
|
||||
|
||||
// Inclusion information: These fields provide information about the inclusion of the
|
||||
// transaction corresponding to this receipt.
|
||||
BlockHash common.Hash `json:"blockHash,omitempty"`
|
||||
BlockNumber *big.Int `json:"blockNumber,omitempty"`
|
||||
TransactionIndex uint `json:"transactionIndex"`
|
||||
|
||||
// OVM legacy: extend receipts with their L1 price (if a rollup tx)
|
||||
L1GasPrice *big.Int `json:"l1GasPrice,omitempty"`
|
||||
L1GasUsed *big.Int `json:"l1GasUsed,omitempty"`
|
||||
L1Fee *big.Int `json:"l1Fee,omitempty"`
|
||||
FeeScalar *big.Float `json:"l1FeeScalar,omitempty"`
|
||||
}
|
||||
|
||||
type receiptMarshaling struct {
|
||||
// Arbitrum specific fields
|
||||
GasUsedForL1 hexutil.Uint64
|
||||
|
||||
Type hexutil.Uint64
|
||||
PostState hexutil.Bytes
|
||||
Status hexutil.Uint64
|
||||
|
@ -79,6 +97,12 @@ type receiptMarshaling struct {
|
|||
GasUsed hexutil.Uint64
|
||||
BlockNumber *hexutil.Big
|
||||
TransactionIndex hexutil.Uint
|
||||
|
||||
// Optimism: extend receipts with their L1 price (if a rollup tx)
|
||||
L1GasPrice *hexutil.Big
|
||||
L1GasUsed *hexutil.Big
|
||||
L1Fee *hexutil.Big
|
||||
FeeScalar *big.Float
|
||||
}
|
||||
|
||||
// receiptRLP is the consensus encoding of a receipt.
|
||||
|
@ -89,32 +113,102 @@ type receiptRLP struct {
|
|||
Logs []*Log
|
||||
}
|
||||
|
||||
type optimismDepositReceiptRlp struct {
|
||||
PostStateOrStatus []byte
|
||||
CumulativeGasUsed uint64
|
||||
Bloom Bloom
|
||||
Logs []*Log
|
||||
// DepositNonce was introduced in Regolith to store the actual nonce used by deposit transactions.
|
||||
// Must be nil for any transactions prior to Regolith or that aren't deposit transactions.
|
||||
DepositNonce *uint64 `rlp:"optional"`
|
||||
}
|
||||
|
||||
// storedReceiptRLP is the storage encoding of a receipt.
|
||||
type storedReceiptRLP struct {
|
||||
PostStateOrStatus []byte
|
||||
CumulativeGasUsed uint64
|
||||
Logs []*LogForStorage
|
||||
L1GasUsed *uint64 `rlp:"optional"`
|
||||
Logs []*Log
|
||||
ContractAddress *common.Address `rlp:"optional"` // set on new versions if an Arbitrum tx type
|
||||
// DepositNonce was introduced in Regolith to store the actual nonce used by deposit transactions.
|
||||
// Must be nil for any transactions prior to Regolith or that aren't deposit transactions.
|
||||
DepositNonce *uint64 `rlp:"optional"`
|
||||
}
|
||||
|
||||
// v4StoredReceiptRLP is the storage encoding of a receipt used in database version 4.
|
||||
type v4StoredReceiptRLP struct {
|
||||
type arbLegacyStoredReceiptRLP struct {
|
||||
PostStateOrStatus []byte
|
||||
CumulativeGasUsed uint64
|
||||
TxHash common.Hash
|
||||
ContractAddress common.Address
|
||||
Logs []*LogForStorage
|
||||
GasUsed uint64
|
||||
L1GasUsed uint64
|
||||
Status uint64
|
||||
ContractAddress common.Address
|
||||
Logs []*Log
|
||||
}
|
||||
|
||||
// v3StoredReceiptRLP is the original storage encoding of a receipt including some unnecessary fields.
|
||||
type v3StoredReceiptRLP struct {
|
||||
// LegacyOptimismStoredReceiptRLP is the pre bedrock storage encoding of a
|
||||
// receipt. It will only exist in the database if it was migrated using the
|
||||
// migration tool. Nodes that sync using snap-sync will not have any of these
|
||||
// entries.
|
||||
type LegacyOptimismStoredReceiptRLP struct {
|
||||
PostStateOrStatus []byte
|
||||
CumulativeGasUsed uint64
|
||||
Bloom Bloom
|
||||
TxHash common.Hash
|
||||
ContractAddress common.Address
|
||||
Logs []*LogForStorage
|
||||
GasUsed uint64
|
||||
L1GasUsed *big.Int
|
||||
L1GasPrice *big.Int
|
||||
L1Fee *big.Int
|
||||
FeeScalar string
|
||||
}
|
||||
|
||||
// LogForStorage is a wrapper around a Log that handles
|
||||
// backward compatibility with prior storage formats.
|
||||
type LogForStorage Log
|
||||
|
||||
// EncodeRLP implements rlp.Encoder.
|
||||
func (l *LogForStorage) EncodeRLP(w io.Writer) error {
|
||||
rl := rlpLog{Address: l.Address, Topics: l.Topics, Data: l.Data}
|
||||
return rlp.Encode(w, &rl)
|
||||
}
|
||||
|
||||
type legacyRlpStorageLog struct {
|
||||
Address common.Address
|
||||
Topics []common.Hash
|
||||
Data []byte
|
||||
BlockNumber uint64
|
||||
TxHash common.Hash
|
||||
TxIndex uint
|
||||
BlockHash common.Hash
|
||||
Index uint
|
||||
}
|
||||
|
||||
// DecodeRLP implements rlp.Decoder.
|
||||
//
|
||||
// Note some redundant fields(e.g. block number, tx hash etc) will be assembled later.
|
||||
func (l *LogForStorage) DecodeRLP(s *rlp.Stream) error {
|
||||
blob, err := s.Raw()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var dec rlpLog
|
||||
err = rlp.DecodeBytes(blob, &dec)
|
||||
if err == nil {
|
||||
*l = LogForStorage{
|
||||
Address: dec.Address,
|
||||
Topics: dec.Topics,
|
||||
Data: dec.Data,
|
||||
}
|
||||
} else {
|
||||
// Try to decode log with previous definition.
|
||||
var dec legacyRlpStorageLog
|
||||
err = rlp.DecodeBytes(blob, &dec)
|
||||
if err == nil {
|
||||
*l = LogForStorage{
|
||||
Address: dec.Address,
|
||||
Topics: dec.Topics,
|
||||
Data: dec.Data,
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// NewReceipt creates a barebone transaction receipt, copying the init fields.
|
||||
|
@ -140,6 +234,7 @@ func (r *Receipt) EncodeRLP(w io.Writer) error {
|
|||
if r.Type == LegacyTxType {
|
||||
return rlp.Encode(w, data)
|
||||
}
|
||||
// It's an EIP-2718 typed TX envelope.
|
||||
buf := encodeBufferPool.Get().(*bytes.Buffer)
|
||||
defer encodeBufferPool.Put(buf)
|
||||
buf.Reset()
|
||||
|
@ -152,8 +247,14 @@ func (r *Receipt) EncodeRLP(w io.Writer) error {
|
|||
// encodeTyped writes the canonical encoding of a typed receipt to w.
|
||||
func (r *Receipt) encodeTyped(data *receiptRLP, w *bytes.Buffer) error {
|
||||
w.WriteByte(r.Type)
|
||||
switch r.Type {
|
||||
case OptimismDepositTxType:
|
||||
withNonce := optimismDepositReceiptRlp{data.PostStateOrStatus, data.CumulativeGasUsed, data.Bloom, data.Logs, r.DepositNonce}
|
||||
return rlp.Encode(w, withNonce)
|
||||
default:
|
||||
return rlp.Encode(w, data)
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalBinary returns the consensus encoding of the receipt.
|
||||
func (r *Receipt) MarshalBinary() ([]byte, error) {
|
||||
|
@ -222,6 +323,15 @@ func (r *Receipt) decodeTyped(b []byte) error {
|
|||
}
|
||||
r.Type = b[0]
|
||||
return r.setFromRLP(data)
|
||||
case OptimismDepositTxType:
|
||||
var data optimismDepositReceiptRlp
|
||||
err := rlp.DecodeBytes(b[1:], &data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
r.Type = b[0]
|
||||
r.DepositNonce = data.DepositNonce
|
||||
return r.setFromRLP(receiptRLP{data.PostStateOrStatus, data.CumulativeGasUsed, data.Bloom, data.Logs})
|
||||
default:
|
||||
return ErrTxTypeNotSupported
|
||||
}
|
||||
|
@ -274,10 +384,23 @@ type ReceiptForStorage Receipt
|
|||
// EncodeRLP implements rlp.Encoder, and flattens all content fields of a receipt
|
||||
// into an RLP stream.
|
||||
func (r *ReceiptForStorage) EncodeRLP(_w io.Writer) error {
|
||||
|
||||
w := rlp.NewEncoderBuffer(_w)
|
||||
outerList := w.List()
|
||||
if r.Type == ArbitrumLegacyTxType {
|
||||
w.WriteBytes(receiptRootArbitrumLegacy)
|
||||
w.WriteUint64(r.CumulativeGasUsed)
|
||||
w.WriteUint64(r.GasUsed)
|
||||
w.WriteUint64(r.GasUsedForL1)
|
||||
w.WriteUint64(r.Status)
|
||||
rlp.Encode(w, r.ContractAddress)
|
||||
} else {
|
||||
w.WriteBytes((*Receipt)(r).statusEncoding())
|
||||
w.WriteUint64(r.CumulativeGasUsed)
|
||||
if isTypeArbitrum(r.Type) {
|
||||
w.WriteUint64(r.GasUsedForL1)
|
||||
}
|
||||
}
|
||||
logList := w.List()
|
||||
for _, log := range r.Logs {
|
||||
if err := rlp.Encode(w, log); err != nil {
|
||||
|
@ -285,6 +408,12 @@ func (r *ReceiptForStorage) EncodeRLP(_w io.Writer) error {
|
|||
}
|
||||
}
|
||||
w.ListEnd(logList)
|
||||
if r.DepositNonce != nil {
|
||||
w.WriteUint64(*r.DepositNonce)
|
||||
}
|
||||
if isTypeArbitrum(r.Type) && r.Type != ArbitrumLegacyTxType && r.ContractAddress != (common.Address{}) {
|
||||
w.WriteBytes(r.ContractAddress[:])
|
||||
}
|
||||
w.ListEnd(outerList)
|
||||
return w.Flush()
|
||||
}
|
||||
|
@ -303,10 +432,61 @@ func (r *ReceiptForStorage) DecodeRLP(s *rlp.Stream) error {
|
|||
if err := decodeStoredReceiptRLP(r, blob); err == nil {
|
||||
return nil
|
||||
}
|
||||
if err := decodeV3StoredReceiptRLP(r, blob); err == nil {
|
||||
if err := decodeArbitrumLegacyStoredReceiptRLP(r, blob); err == nil {
|
||||
return nil
|
||||
}
|
||||
return decodeV4StoredReceiptRLP(r, blob)
|
||||
return decodeLegacyOptimismReceiptRLP(r, blob)
|
||||
}
|
||||
|
||||
func decodeArbitrumLegacyStoredReceiptRLP(r *ReceiptForStorage, blob []byte) error {
|
||||
var stored arbLegacyStoredReceiptRLP
|
||||
if err := rlp.DecodeBytes(blob, &stored); err != nil {
|
||||
return err
|
||||
}
|
||||
if !bytes.Equal(stored.PostStateOrStatus, receiptRootArbitrumLegacy) {
|
||||
return errors.New("not arbitrum legacy Tx")
|
||||
}
|
||||
r.Type = ArbitrumLegacyTxType
|
||||
(*Receipt)(r).PostState = receiptRootArbitrumLegacy
|
||||
r.Status = stored.Status
|
||||
r.CumulativeGasUsed = stored.CumulativeGasUsed
|
||||
r.GasUsed = stored.GasUsed
|
||||
r.GasUsedForL1 = stored.L1GasUsed
|
||||
r.ContractAddress = stored.ContractAddress
|
||||
r.Logs = stored.Logs
|
||||
r.Bloom = CreateBloom(Receipts{(*Receipt)(r)})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func decodeLegacyOptimismReceiptRLP(r *ReceiptForStorage, blob []byte) error {
|
||||
var stored LegacyOptimismStoredReceiptRLP
|
||||
if err := rlp.DecodeBytes(blob, &stored); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := (*Receipt)(r).setStatus(stored.PostStateOrStatus); err != nil {
|
||||
return err
|
||||
}
|
||||
r.CumulativeGasUsed = stored.CumulativeGasUsed
|
||||
r.Logs = make([]*Log, len(stored.Logs))
|
||||
for i, log := range stored.Logs {
|
||||
r.Logs[i] = (*Log)(log)
|
||||
}
|
||||
r.Bloom = CreateBloom(Receipts{(*Receipt)(r)})
|
||||
// UsingOVM
|
||||
scalar := new(big.Float)
|
||||
if stored.FeeScalar != "" {
|
||||
var ok bool
|
||||
scalar, ok = scalar.SetString(stored.FeeScalar)
|
||||
if !ok {
|
||||
return errors.New("cannot parse fee scalar")
|
||||
}
|
||||
}
|
||||
r.L1GasUsed = stored.L1GasUsed
|
||||
r.L1GasPrice = stored.L1GasPrice
|
||||
r.L1Fee = stored.L1Fee
|
||||
r.FeeScalar = scalar
|
||||
return nil
|
||||
}
|
||||
|
||||
func decodeStoredReceiptRLP(r *ReceiptForStorage, blob []byte) error {
|
||||
|
@ -318,52 +498,16 @@ func decodeStoredReceiptRLP(r *ReceiptForStorage, blob []byte) error {
|
|||
return err
|
||||
}
|
||||
r.CumulativeGasUsed = stored.CumulativeGasUsed
|
||||
r.Logs = make([]*Log, len(stored.Logs))
|
||||
for i, log := range stored.Logs {
|
||||
r.Logs[i] = (*Log)(log)
|
||||
if stored.L1GasUsed != nil {
|
||||
r.GasUsedForL1 = *stored.L1GasUsed
|
||||
}
|
||||
r.Logs = stored.Logs
|
||||
r.Bloom = CreateBloom(Receipts{(*Receipt)(r)})
|
||||
|
||||
return nil
|
||||
if stored.ContractAddress != nil {
|
||||
r.ContractAddress = *stored.ContractAddress
|
||||
}
|
||||
|
||||
func decodeV4StoredReceiptRLP(r *ReceiptForStorage, blob []byte) error {
|
||||
var stored v4StoredReceiptRLP
|
||||
if err := rlp.DecodeBytes(blob, &stored); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := (*Receipt)(r).setStatus(stored.PostStateOrStatus); err != nil {
|
||||
return err
|
||||
}
|
||||
r.CumulativeGasUsed = stored.CumulativeGasUsed
|
||||
r.TxHash = stored.TxHash
|
||||
r.ContractAddress = stored.ContractAddress
|
||||
r.GasUsed = stored.GasUsed
|
||||
r.Logs = make([]*Log, len(stored.Logs))
|
||||
for i, log := range stored.Logs {
|
||||
r.Logs[i] = (*Log)(log)
|
||||
}
|
||||
r.Bloom = CreateBloom(Receipts{(*Receipt)(r)})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func decodeV3StoredReceiptRLP(r *ReceiptForStorage, blob []byte) error {
|
||||
var stored v3StoredReceiptRLP
|
||||
if err := rlp.DecodeBytes(blob, &stored); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := (*Receipt)(r).setStatus(stored.PostStateOrStatus); err != nil {
|
||||
return err
|
||||
}
|
||||
r.CumulativeGasUsed = stored.CumulativeGasUsed
|
||||
r.Bloom = stored.Bloom
|
||||
r.TxHash = stored.TxHash
|
||||
r.ContractAddress = stored.ContractAddress
|
||||
r.GasUsed = stored.GasUsed
|
||||
r.Logs = make([]*Log, len(stored.Logs))
|
||||
for i, log := range stored.Logs {
|
||||
r.Logs[i] = (*Log)(log)
|
||||
if stored.DepositNonce != nil {
|
||||
r.DepositNonce = stored.DepositNonce
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -379,13 +523,10 @@ func (rs Receipts) EncodeIndex(i int, w *bytes.Buffer) {
|
|||
r := rs[i]
|
||||
data := &receiptRLP{r.statusEncoding(), r.CumulativeGasUsed, r.Bloom, r.Logs}
|
||||
switch r.Type {
|
||||
case LegacyTxType:
|
||||
case LegacyTxType, ArbitrumLegacyTxType:
|
||||
rlp.Encode(w, data)
|
||||
case AccessListTxType:
|
||||
w.WriteByte(AccessListTxType)
|
||||
rlp.Encode(w, data)
|
||||
case DynamicFeeTxType:
|
||||
w.WriteByte(DynamicFeeTxType)
|
||||
case AccessListTxType, DynamicFeeTxType, ArbitrumDepositTxType, ArbitrumUnsignedTxType, ArbitrumContractTxType, ArbitrumRetryTxType, ArbitrumSubmitRetryableTxType, ArbitrumInternalTxType, OptimismDepositTxType:
|
||||
w.WriteByte(r.Type)
|
||||
rlp.Encode(w, data)
|
||||
default:
|
||||
// For unsupported types, write nothing. Since this is for
|
||||
|
@ -396,7 +537,7 @@ func (rs Receipts) EncodeIndex(i int, w *bytes.Buffer) {
|
|||
|
||||
// DeriveFields fills the receipts with their computed fields based on consensus
|
||||
// data and contextual infos like containing block and transactions.
|
||||
func (rs Receipts) DeriveFields(config *params.ChainConfig, hash common.Hash, number uint64, txs Transactions) error {
|
||||
func (rs Receipts) DeriveFields(config *params.ChainConfig, hash common.Hash, number uint64, time uint64, baseFee *big.Int, txs Transactions) error {
|
||||
signer := MakeSigner(config, new(big.Int).SetUint64(number))
|
||||
|
||||
logIndex := uint(0)
|
||||
|
@ -408,23 +549,33 @@ func (rs Receipts) DeriveFields(config *params.ChainConfig, hash common.Hash, nu
|
|||
rs[i].Type = txs[i].Type()
|
||||
rs[i].TxHash = txs[i].Hash()
|
||||
|
||||
rs[i].EffectiveGasPrice = txs[i].inner.effectiveGasPrice(new(big.Int), baseFee)
|
||||
|
||||
// block location fields
|
||||
rs[i].BlockHash = hash
|
||||
rs[i].BlockNumber = new(big.Int).SetUint64(number)
|
||||
rs[i].TransactionIndex = uint(i)
|
||||
|
||||
if rs[i].Type != ArbitrumLegacyTxType {
|
||||
// The contract address can be derived from the transaction itself
|
||||
if txs[i].To() == nil {
|
||||
if rs[i].ContractAddress == (common.Address{}) {
|
||||
// Deriving the signer is expensive, only do if it's actually needed
|
||||
from, _ := Sender(signer, txs[i])
|
||||
rs[i].ContractAddress = crypto.CreateAddress(from, txs[i].Nonce())
|
||||
}
|
||||
} else {
|
||||
rs[i].ContractAddress = common.Address{}
|
||||
}
|
||||
|
||||
// The used gas can be calculated based on previous r
|
||||
if i == 0 {
|
||||
rs[i].GasUsed = rs[i].CumulativeGasUsed
|
||||
} else {
|
||||
rs[i].GasUsed = rs[i].CumulativeGasUsed - rs[i-1].CumulativeGasUsed
|
||||
}
|
||||
}
|
||||
|
||||
// The derived log fields can simply be set from the block and transaction
|
||||
for j := 0; j < len(rs[i].Logs); j++ {
|
||||
rs[i].Logs[j].BlockNumber = number
|
||||
|
|
88
vendor/github.com/ethereum/go-ethereum/core/types/rollup_l1_cost.go
generated
vendored
Normal file
88
vendor/github.com/ethereum/go-ethereum/core/types/rollup_l1_cost.go
generated
vendored
Normal file
|
@ -0,0 +1,88 @@
|
|||
// Copyright 2022 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
type RollupGasData struct {
|
||||
Zeroes, Ones uint64
|
||||
}
|
||||
|
||||
/*
|
||||
// Unused, depends on other unneeded changes
|
||||
func (r RollupGasData) DataGas(time uint64, cfg *params.ChainConfig) (gas uint64) {
|
||||
gas = r.Zeroes * params.TxDataZeroGas
|
||||
if cfg.IsRegolith(time) {
|
||||
gas += r.Ones * params.TxDataNonZeroGasEIP2028
|
||||
} else {
|
||||
gas += (r.Ones + 68) * params.TxDataNonZeroGasEIP2028
|
||||
}
|
||||
return gas
|
||||
}
|
||||
*/
|
||||
|
||||
type StateGetter interface {
|
||||
GetState(common.Address, common.Hash) common.Hash
|
||||
}
|
||||
|
||||
// L1CostFunc is used in the state transition to determine the cost of a rollup message.
|
||||
// Returns nil if there is no cost.
|
||||
type L1CostFunc func(blockNum uint64, blockTime uint64, dataGas RollupGasData, isDepositTx bool) *big.Int
|
||||
|
||||
var (
|
||||
L1BaseFeeSlot = common.BigToHash(big.NewInt(1))
|
||||
OverheadSlot = common.BigToHash(big.NewInt(5))
|
||||
ScalarSlot = common.BigToHash(big.NewInt(6))
|
||||
)
|
||||
|
||||
var L1BlockAddr = common.HexToAddress("0x4200000000000000000000000000000000000015")
|
||||
|
||||
// NewL1CostFunc returns a function used for calculating L1 fee cost.
|
||||
// This depends on the oracles because gas costs can change over time.
|
||||
// It returns nil if there is no applicable cost function.
|
||||
/*
|
||||
// Unused, depends on other unneeded changes
|
||||
func NewL1CostFunc(config *params.ChainConfig, statedb StateGetter) L1CostFunc {
|
||||
cacheBlockNum := ^uint64(0)
|
||||
var l1BaseFee, overhead, scalar *big.Int
|
||||
return func(blockNum uint64, blockTime uint64, dataGas RollupGasData, isDepositTx bool) *big.Int {
|
||||
rollupDataGas := dataGas.DataGas(blockTime, config) // Only fake txs for RPC view-calls are 0.
|
||||
if config.Optimism == nil || isDepositTx || rollupDataGas == 0 {
|
||||
return nil
|
||||
}
|
||||
if blockNum != cacheBlockNum {
|
||||
l1BaseFee = statedb.GetState(L1BlockAddr, L1BaseFeeSlot).Big()
|
||||
overhead = statedb.GetState(L1BlockAddr, OverheadSlot).Big()
|
||||
scalar = statedb.GetState(L1BlockAddr, ScalarSlot).Big()
|
||||
cacheBlockNum = blockNum
|
||||
}
|
||||
return L1Cost(rollupDataGas, l1BaseFee, overhead, scalar)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func L1Cost(rollupDataGas uint64, l1BaseFee, overhead, scalar *big.Int) *big.Int {
|
||||
l1GasUsed := new(big.Int).SetUint64(rollupDataGas)
|
||||
l1GasUsed = l1GasUsed.Add(l1GasUsed, overhead)
|
||||
l1Cost := l1GasUsed.Mul(l1GasUsed, l1BaseFee)
|
||||
l1Cost = l1Cost.Mul(l1Cost, scalar)
|
||||
return l1Cost.Div(l1Cost, big.NewInt(1_000_000))
|
||||
}
|
|
@ -28,6 +28,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
)
|
||||
|
||||
|
@ -67,6 +68,9 @@ type Transaction struct {
|
|||
hash atomic.Value
|
||||
size atomic.Value
|
||||
from atomic.Value
|
||||
|
||||
// cache of RollupGasData details to compute the gas the tx takes on L1 for its share of rollup data
|
||||
rollupGas atomic.Value
|
||||
}
|
||||
|
||||
// NewTx creates a new transaction.
|
||||
|
@ -76,6 +80,18 @@ func NewTx(inner TxData) *Transaction {
|
|||
return tx
|
||||
}
|
||||
|
||||
func isTypeOptimism(txType uint8) bool {
|
||||
return txType == OptimismDepositTxType
|
||||
}
|
||||
|
||||
func isTypeArbitrum(txType uint8) bool {
|
||||
switch txType {
|
||||
case ArbitrumDepositTxType, ArbitrumUnsignedTxType, ArbitrumContractTxType, ArbitrumRetryTxType, ArbitrumSubmitRetryableTxType, ArbitrumInternalTxType, ArbitrumLegacyTxType:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// TxData is the underlying data of a transaction.
|
||||
//
|
||||
// This is implemented by DynamicFeeTx, LegacyTx and AccessListTx.
|
||||
|
@ -93,11 +109,19 @@ type TxData interface {
|
|||
value() *big.Int
|
||||
nonce() uint64
|
||||
to() *common.Address
|
||||
isFake() bool
|
||||
isSystemTx() bool
|
||||
|
||||
rawSignatureValues() (v, r, s *big.Int)
|
||||
setSignatureValues(chainID, v, r, s *big.Int)
|
||||
|
||||
isFake() bool
|
||||
// effectiveGasPrice computes the gas price paid by the transaction, given
|
||||
// the inclusion block baseFee.
|
||||
//
|
||||
// Unlike other TxData methods, the returned *big.Int should be an independent
|
||||
// copy of the computed value, i.e. callers are allowed to mutate the result.
|
||||
// Method implementations can use 'dst' to store the result.
|
||||
effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int
|
||||
}
|
||||
|
||||
// EncodeRLP implements rlp.Encoder
|
||||
|
@ -144,7 +168,7 @@ func (tx *Transaction) DecodeRLP(s *rlp.Stream) error {
|
|||
var inner LegacyTx
|
||||
err := s.Decode(&inner)
|
||||
if err == nil {
|
||||
tx.setDecoded(&inner, int(rlp.ListSize(size)))
|
||||
tx.setDecoded(&inner, rlp.ListSize(size))
|
||||
}
|
||||
return err
|
||||
default:
|
||||
|
@ -155,7 +179,7 @@ func (tx *Transaction) DecodeRLP(s *rlp.Stream) error {
|
|||
}
|
||||
inner, err := tx.decodeTyped(b, true)
|
||||
if err == nil {
|
||||
tx.setDecoded(inner, len(b))
|
||||
tx.setDecoded(inner, uint64(len(b)))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
@ -171,7 +195,7 @@ func (tx *Transaction) UnmarshalBinary(b []byte) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tx.setDecoded(&data, len(b))
|
||||
tx.setDecoded(&data, uint64(len(b)))
|
||||
return nil
|
||||
}
|
||||
// It's an EIP2718 typed transaction envelope.
|
||||
|
@ -179,16 +203,16 @@ func (tx *Transaction) UnmarshalBinary(b []byte) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tx.setDecoded(inner, len(b))
|
||||
tx.setDecoded(inner, uint64(len(b)))
|
||||
return nil
|
||||
}
|
||||
|
||||
// decodeTyped decodes a typed transaction from the canonical format.
|
||||
func (tx *Transaction) decodeTyped(b []byte, arbParsing bool) (TxData, error) {
|
||||
func (tx *Transaction) decodeTyped(b []byte, l2Parsing bool) (TxData, error) {
|
||||
if len(b) <= 1 {
|
||||
return nil, errShortTypedTx
|
||||
}
|
||||
if arbParsing {
|
||||
if l2Parsing {
|
||||
switch b[0] {
|
||||
case ArbitrumDepositTxType:
|
||||
var inner ArbitrumDepositTx
|
||||
|
@ -214,6 +238,14 @@ func (tx *Transaction) decodeTyped(b []byte, arbParsing bool) (TxData, error) {
|
|||
var inner ArbitrumSubmitRetryableTx
|
||||
err := rlp.DecodeBytes(b[1:], &inner)
|
||||
return &inner, err
|
||||
case ArbitrumLegacyTxType:
|
||||
var inner ArbitrumLegacyTxData
|
||||
err := rlp.DecodeBytes(b[1:], &inner)
|
||||
return &inner, err
|
||||
case OptimismDepositTxType:
|
||||
var inner OptimismDepositTx
|
||||
err := rlp.DecodeBytes(b[1:], &inner)
|
||||
return &inner, err
|
||||
}
|
||||
}
|
||||
switch b[0] {
|
||||
|
@ -225,21 +257,17 @@ func (tx *Transaction) decodeTyped(b []byte, arbParsing bool) (TxData, error) {
|
|||
var inner DynamicFeeTx
|
||||
err := rlp.DecodeBytes(b[1:], &inner)
|
||||
return &inner, err
|
||||
case ArbitrumLegacyTxType:
|
||||
var inner ArbitrumLegacyTxData
|
||||
err := rlp.DecodeBytes(b[1:], &inner)
|
||||
return &inner, err
|
||||
default:
|
||||
return nil, ErrTxTypeNotSupported
|
||||
}
|
||||
}
|
||||
|
||||
// setDecoded sets the inner transaction and size after decoding.
|
||||
func (tx *Transaction) setDecoded(inner TxData, size int) {
|
||||
func (tx *Transaction) setDecoded(inner TxData, size uint64) {
|
||||
tx.inner = inner
|
||||
tx.time = time.Now()
|
||||
if size > 0 {
|
||||
tx.size.Store(common.StorageSize(size))
|
||||
tx.size.Store(size)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -328,12 +356,56 @@ func (tx *Transaction) Value() *big.Int { return new(big.Int).Set(tx.inner.value
|
|||
// Nonce returns the sender account nonce of the transaction.
|
||||
func (tx *Transaction) Nonce() uint64 { return tx.inner.nonce() }
|
||||
|
||||
// EffectiveNonce returns the nonce that was actually used as part of transaction execution
|
||||
// Returns nil if the effective nonce is not known
|
||||
func (tx *Transaction) EffectiveNonce() *uint64 {
|
||||
type txWithEffectiveNonce interface {
|
||||
effectiveNonce() *uint64
|
||||
}
|
||||
|
||||
if itx, ok := tx.inner.(txWithEffectiveNonce); ok {
|
||||
return itx.effectiveNonce()
|
||||
}
|
||||
nonce := tx.inner.nonce()
|
||||
return &nonce
|
||||
}
|
||||
|
||||
// To returns the recipient address of the transaction.
|
||||
// For contract-creation transactions, To returns nil.
|
||||
func (tx *Transaction) To() *common.Address {
|
||||
return copyAddressPtr(tx.inner.to())
|
||||
}
|
||||
|
||||
// SourceHash returns the hash that uniquely identifies the source of the deposit tx,
|
||||
// e.g. a user deposit event, or a L1 info deposit included in a specific L2 block height.
|
||||
// Non-deposit transactions return a zeroed hash.
|
||||
func (tx *Transaction) SourceHash() common.Hash {
|
||||
if dep, ok := tx.inner.(*OptimismDepositTx); ok {
|
||||
return dep.SourceHash
|
||||
}
|
||||
return common.Hash{}
|
||||
}
|
||||
|
||||
// Mint returns the ETH to mint in the deposit tx.
|
||||
// This returns nil if there is nothing to mint, or if this is not a deposit tx.
|
||||
func (tx *Transaction) Mint() *big.Int {
|
||||
if dep, ok := tx.inner.(*OptimismDepositTx); ok {
|
||||
return dep.Mint
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// IsDepositTx returns true if the transaction is a deposit tx type.
|
||||
func (tx *Transaction) IsDepositTx() bool {
|
||||
return tx.Type() == OptimismDepositTxType
|
||||
}
|
||||
|
||||
// IsSystemTx returns true for deposits that are system transactions. These transactions
|
||||
// are executed in an unmetered environment & do not contribute to the block gas limit.
|
||||
func (tx *Transaction) IsSystemTx() bool {
|
||||
return tx.inner.isSystemTx()
|
||||
}
|
||||
|
||||
// Cost returns gas * gasPrice + value.
|
||||
func (tx *Transaction) Cost() *big.Int {
|
||||
total := new(big.Int).Mul(tx.GasPrice(), new(big.Int).SetUint64(tx.Gas()))
|
||||
|
@ -341,6 +413,30 @@ func (tx *Transaction) Cost() *big.Int {
|
|||
return total
|
||||
}
|
||||
|
||||
// RollupDataGas is the amount of gas it takes to confirm the tx on L1 as a rollup
|
||||
func (tx *Transaction) RollupDataGas() RollupGasData {
|
||||
if tx.Type() == OptimismDepositTxType {
|
||||
return RollupGasData{}
|
||||
}
|
||||
if v := tx.rollupGas.Load(); v != nil {
|
||||
return v.(RollupGasData)
|
||||
}
|
||||
data, err := tx.MarshalBinary()
|
||||
if err != nil { // Silent error, invalid txs will not be marshalled/unmarshalled for batch submission anyway.
|
||||
log.Error("failed to encode tx for L1 cost computation", "err", err)
|
||||
}
|
||||
var out RollupGasData
|
||||
for _, byt := range data {
|
||||
if byt == 0 {
|
||||
out.Zeroes++
|
||||
} else {
|
||||
out.Ones++
|
||||
}
|
||||
}
|
||||
tx.rollupGas.Store(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// RawSignatureValues returns the V, R, S signature values of the transaction.
|
||||
// The return values should not be modified by the caller.
|
||||
func (tx *Transaction) RawSignatureValues() (v, r, s *big.Int) {
|
||||
|
@ -371,6 +467,9 @@ func (tx *Transaction) GasTipCapIntCmp(other *big.Int) int {
|
|||
// Note: if the effective gasTipCap is negative, this method returns both error
|
||||
// the actual negative value, _and_ ErrGasFeeCapTooLow
|
||||
func (tx *Transaction) EffectiveGasTip(baseFee *big.Int) (*big.Int, error) {
|
||||
if tx.Type() == OptimismDepositTxType {
|
||||
return new(big.Int), nil
|
||||
}
|
||||
if baseFee == nil {
|
||||
return tx.GasTipCap(), nil
|
||||
}
|
||||
|
@ -423,16 +522,21 @@ func (tx *Transaction) Hash() common.Hash {
|
|||
return h
|
||||
}
|
||||
|
||||
// Size returns the true RLP encoded storage size of the transaction, either by
|
||||
// encoding and returning it, or returning a previously cached value.
|
||||
func (tx *Transaction) Size() common.StorageSize {
|
||||
// Size returns the true encoded storage size of the transaction, either by encoding
|
||||
// and returning it, or returning a previously cached value.
|
||||
func (tx *Transaction) Size() uint64 {
|
||||
if size := tx.size.Load(); size != nil {
|
||||
return size.(common.StorageSize)
|
||||
return size.(uint64)
|
||||
}
|
||||
c := writeCounter(0)
|
||||
rlp.Encode(&c, &tx.inner)
|
||||
tx.size.Store(common.StorageSize(c))
|
||||
return common.StorageSize(c)
|
||||
|
||||
size := uint64(c)
|
||||
if tx.Type() != LegacyTxType {
|
||||
size += 1 // type byte
|
||||
}
|
||||
tx.size.Store(size)
|
||||
return size
|
||||
}
|
||||
|
||||
// WithSignature returns a new transaction with the given signature.
|
||||
|
@ -557,6 +661,7 @@ func (s *TxByPriceAndTime) Pop() interface{} {
|
|||
old := *s
|
||||
n := len(old)
|
||||
x := old[n-1]
|
||||
old[n-1] = nil
|
||||
*s = old[0 : n-1]
|
||||
return x
|
||||
}
|
||||
|
@ -648,6 +753,7 @@ type Message struct {
|
|||
accessList AccessList
|
||||
checkNonce bool
|
||||
isFake bool
|
||||
isSystemTx bool
|
||||
}
|
||||
|
||||
type MessageRunMode uint8
|
||||
|
@ -672,6 +778,7 @@ func NewMessage(from common.Address, to *common.Address, nonce uint64, amount *b
|
|||
accessList: accessList,
|
||||
checkNonce: checkNonce,
|
||||
isFake: false,
|
||||
isSystemTx: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -691,6 +798,7 @@ func (tx *Transaction) AsMessage(s Signer, baseFee *big.Int) (Message, error) {
|
|||
accessList: tx.AccessList(),
|
||||
checkNonce: true,
|
||||
isFake: tx.inner.isFake(),
|
||||
isSystemTx: tx.inner.isSystemTx(),
|
||||
}
|
||||
// If baseFee provided, set gasPrice to effectiveGasPrice.
|
||||
if baseFee != nil {
|
||||
|
@ -716,6 +824,7 @@ func (m Message) Data() []byte { return m.data }
|
|||
func (m Message) AccessList() AccessList { return m.accessList }
|
||||
func (m Message) CheckNonce() bool { return m.checkNonce }
|
||||
func (m Message) IsFake() bool { return m.isFake }
|
||||
func (m Message) IsSystemTx() bool { return m.isSystemTx }
|
||||
|
||||
// copyAddressPtr copies an address.
|
||||
func copyAddressPtr(a *common.Address) *common.Address {
|
||||
|
|
|
@ -19,10 +19,12 @@ package types
|
|||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io"
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
)
|
||||
|
||||
// txJSON is the JSON representation of transactions.
|
||||
|
@ -42,12 +44,18 @@ type txJSON struct {
|
|||
S *hexutil.Big `json:"s"`
|
||||
To *common.Address `json:"to"`
|
||||
|
||||
// Optimism Deposit transaction fields
|
||||
SourceHash *common.Hash `json:"sourceHash,omitempty"`
|
||||
From *common.Address `json:"from,omitempty"`
|
||||
Mint *hexutil.Big `json:"mint,omitempty"`
|
||||
IsSystemTx *bool `json:"isSystemTx,omitempty"`
|
||||
|
||||
// Access list transaction fields:
|
||||
ChainID *hexutil.Big `json:"chainId,omitempty"`
|
||||
AccessList *AccessList `json:"accessList,omitempty"`
|
||||
|
||||
// Arbitrum fields:
|
||||
From *common.Address `json:"from,omitempty"` // Contract SubmitRetryable Unsigned Retry
|
||||
//From *common.Address `json:"from,omitempty"` // Contract SubmitRetryable Unsigned Retry
|
||||
RequestId *common.Hash `json:"requestId,omitempty"` // Contract SubmitRetryable Deposit
|
||||
TicketId *common.Hash `json:"ticketId,omitempty"` // Retry
|
||||
MaxRefund *hexutil.Big `json:"maxRefund,omitempty"` // Retry
|
||||
|
@ -68,11 +76,11 @@ type txJSON struct {
|
|||
}
|
||||
|
||||
// MarshalJSON marshals as JSON with a hash.
|
||||
func (t *Transaction) MarshalJSON() ([]byte, error) {
|
||||
func (tx *Transaction) MarshalJSON() ([]byte, error) {
|
||||
var enc txJSON
|
||||
// These are set for all tx types.
|
||||
enc.Hash = t.Hash()
|
||||
enc.Type = hexutil.Uint64(t.Type())
|
||||
enc.Hash = tx.Hash()
|
||||
enc.Type = hexutil.Uint64(tx.Type())
|
||||
|
||||
// Arbitrum: set to 0 for compatibility
|
||||
var zero uint64
|
||||
|
@ -86,118 +94,130 @@ func (t *Transaction) MarshalJSON() ([]byte, error) {
|
|||
enc.S = (*hexutil.Big)(common.Big0)
|
||||
|
||||
// Other fields are set conditionally depending on tx type.
|
||||
switch tx := t.inner.(type) {
|
||||
switch itx := tx.inner.(type) {
|
||||
case *LegacyTx:
|
||||
enc.Nonce = (*hexutil.Uint64)(&tx.Nonce)
|
||||
enc.Gas = (*hexutil.Uint64)(&tx.Gas)
|
||||
enc.GasPrice = (*hexutil.Big)(tx.GasPrice)
|
||||
enc.Value = (*hexutil.Big)(tx.Value)
|
||||
enc.Data = (*hexutil.Bytes)(&tx.Data)
|
||||
enc.To = t.To()
|
||||
enc.V = (*hexutil.Big)(tx.V)
|
||||
enc.R = (*hexutil.Big)(tx.R)
|
||||
enc.S = (*hexutil.Big)(tx.S)
|
||||
enc.Nonce = (*hexutil.Uint64)(&itx.Nonce)
|
||||
enc.Gas = (*hexutil.Uint64)(&itx.Gas)
|
||||
enc.GasPrice = (*hexutil.Big)(itx.GasPrice)
|
||||
enc.Value = (*hexutil.Big)(itx.Value)
|
||||
enc.Data = (*hexutil.Bytes)(&itx.Data)
|
||||
enc.To = tx.To()
|
||||
enc.V = (*hexutil.Big)(itx.V)
|
||||
enc.R = (*hexutil.Big)(itx.R)
|
||||
enc.S = (*hexutil.Big)(itx.S)
|
||||
case *AccessListTx:
|
||||
enc.ChainID = (*hexutil.Big)(tx.ChainID)
|
||||
enc.AccessList = &tx.AccessList
|
||||
enc.Nonce = (*hexutil.Uint64)(&tx.Nonce)
|
||||
enc.Gas = (*hexutil.Uint64)(&tx.Gas)
|
||||
enc.GasPrice = (*hexutil.Big)(tx.GasPrice)
|
||||
enc.Value = (*hexutil.Big)(tx.Value)
|
||||
enc.Data = (*hexutil.Bytes)(&tx.Data)
|
||||
enc.To = t.To()
|
||||
enc.V = (*hexutil.Big)(tx.V)
|
||||
enc.R = (*hexutil.Big)(tx.R)
|
||||
enc.S = (*hexutil.Big)(tx.S)
|
||||
enc.ChainID = (*hexutil.Big)(itx.ChainID)
|
||||
enc.AccessList = &itx.AccessList
|
||||
enc.Nonce = (*hexutil.Uint64)(&itx.Nonce)
|
||||
enc.Gas = (*hexutil.Uint64)(&itx.Gas)
|
||||
enc.GasPrice = (*hexutil.Big)(itx.GasPrice)
|
||||
enc.Value = (*hexutil.Big)(itx.Value)
|
||||
enc.Data = (*hexutil.Bytes)(&itx.Data)
|
||||
enc.To = tx.To()
|
||||
enc.V = (*hexutil.Big)(itx.V)
|
||||
enc.R = (*hexutil.Big)(itx.R)
|
||||
enc.S = (*hexutil.Big)(itx.S)
|
||||
case *DynamicFeeTx:
|
||||
enc.ChainID = (*hexutil.Big)(tx.ChainID)
|
||||
enc.AccessList = &tx.AccessList
|
||||
enc.Nonce = (*hexutil.Uint64)(&tx.Nonce)
|
||||
enc.Gas = (*hexutil.Uint64)(&tx.Gas)
|
||||
enc.MaxFeePerGas = (*hexutil.Big)(tx.GasFeeCap)
|
||||
enc.MaxPriorityFeePerGas = (*hexutil.Big)(tx.GasTipCap)
|
||||
enc.Value = (*hexutil.Big)(tx.Value)
|
||||
enc.Data = (*hexutil.Bytes)(&tx.Data)
|
||||
enc.To = t.To()
|
||||
enc.V = (*hexutil.Big)(tx.V)
|
||||
enc.R = (*hexutil.Big)(tx.R)
|
||||
enc.S = (*hexutil.Big)(tx.S)
|
||||
enc.ChainID = (*hexutil.Big)(itx.ChainID)
|
||||
enc.AccessList = &itx.AccessList
|
||||
enc.Nonce = (*hexutil.Uint64)(&itx.Nonce)
|
||||
enc.Gas = (*hexutil.Uint64)(&itx.Gas)
|
||||
enc.MaxFeePerGas = (*hexutil.Big)(itx.GasFeeCap)
|
||||
enc.MaxPriorityFeePerGas = (*hexutil.Big)(itx.GasTipCap)
|
||||
enc.Value = (*hexutil.Big)(itx.Value)
|
||||
enc.Data = (*hexutil.Bytes)(&itx.Data)
|
||||
enc.To = tx.To()
|
||||
enc.V = (*hexutil.Big)(itx.V)
|
||||
enc.R = (*hexutil.Big)(itx.R)
|
||||
enc.S = (*hexutil.Big)(itx.S)
|
||||
case *ArbitrumLegacyTxData:
|
||||
enc.Nonce = (*hexutil.Uint64)(&tx.Nonce)
|
||||
enc.Gas = (*hexutil.Uint64)(&tx.Gas)
|
||||
enc.GasPrice = (*hexutil.Big)(tx.GasPrice)
|
||||
enc.Value = (*hexutil.Big)(tx.Value)
|
||||
enc.Data = (*hexutil.Bytes)(&tx.Data)
|
||||
enc.To = t.To()
|
||||
enc.V = (*hexutil.Big)(tx.V)
|
||||
enc.R = (*hexutil.Big)(tx.R)
|
||||
enc.S = (*hexutil.Big)(tx.S)
|
||||
enc.EffectiveGasPrice = (*hexutil.Uint64)(&tx.EffectiveGasPrice)
|
||||
enc.L1BlockNumber = (*hexutil.Uint64)(&tx.L1BlockNumber)
|
||||
enc.From = tx.Sender
|
||||
enc.Nonce = (*hexutil.Uint64)(&itx.Nonce)
|
||||
enc.Gas = (*hexutil.Uint64)(&itx.Gas)
|
||||
enc.GasPrice = (*hexutil.Big)(itx.GasPrice)
|
||||
enc.Value = (*hexutil.Big)(itx.Value)
|
||||
enc.Data = (*hexutil.Bytes)(&itx.Data)
|
||||
enc.To = tx.To()
|
||||
enc.V = (*hexutil.Big)(itx.V)
|
||||
enc.R = (*hexutil.Big)(itx.R)
|
||||
enc.S = (*hexutil.Big)(itx.S)
|
||||
enc.EffectiveGasPrice = (*hexutil.Uint64)(&itx.EffectiveGasPrice)
|
||||
enc.L1BlockNumber = (*hexutil.Uint64)(&itx.L1BlockNumber)
|
||||
enc.From = itx.Sender
|
||||
case *ArbitrumInternalTx:
|
||||
enc.ChainID = (*hexutil.Big)(tx.ChainId)
|
||||
enc.Data = (*hexutil.Bytes)(&tx.Data)
|
||||
enc.ChainID = (*hexutil.Big)(itx.ChainId)
|
||||
enc.Data = (*hexutil.Bytes)(&itx.Data)
|
||||
case *ArbitrumDepositTx:
|
||||
enc.RequestId = &tx.L1RequestId
|
||||
enc.From = &tx.From
|
||||
enc.ChainID = (*hexutil.Big)(tx.ChainId)
|
||||
enc.Value = (*hexutil.Big)(tx.Value)
|
||||
enc.To = t.To()
|
||||
enc.RequestId = &itx.L1RequestId
|
||||
enc.From = &itx.From
|
||||
enc.ChainID = (*hexutil.Big)(itx.ChainId)
|
||||
enc.Value = (*hexutil.Big)(itx.Value)
|
||||
enc.To = tx.To()
|
||||
case *ArbitrumUnsignedTx:
|
||||
enc.From = (*common.Address)(&tx.From)
|
||||
enc.ChainID = (*hexutil.Big)(tx.ChainId)
|
||||
enc.Nonce = (*hexutil.Uint64)(&tx.Nonce)
|
||||
enc.Gas = (*hexutil.Uint64)(&tx.Gas)
|
||||
enc.MaxFeePerGas = (*hexutil.Big)(tx.GasFeeCap)
|
||||
enc.Value = (*hexutil.Big)(tx.Value)
|
||||
enc.Data = (*hexutil.Bytes)(&tx.Data)
|
||||
enc.To = t.To()
|
||||
enc.From = (*common.Address)(&itx.From)
|
||||
enc.ChainID = (*hexutil.Big)(itx.ChainId)
|
||||
enc.Nonce = (*hexutil.Uint64)(&itx.Nonce)
|
||||
enc.Gas = (*hexutil.Uint64)(&itx.Gas)
|
||||
enc.MaxFeePerGas = (*hexutil.Big)(itx.GasFeeCap)
|
||||
enc.Value = (*hexutil.Big)(itx.Value)
|
||||
enc.Data = (*hexutil.Bytes)(&itx.Data)
|
||||
enc.To = tx.To()
|
||||
case *ArbitrumContractTx:
|
||||
enc.RequestId = &tx.RequestId
|
||||
enc.From = (*common.Address)(&tx.From)
|
||||
enc.ChainID = (*hexutil.Big)(tx.ChainId)
|
||||
enc.Gas = (*hexutil.Uint64)(&tx.Gas)
|
||||
enc.MaxFeePerGas = (*hexutil.Big)(tx.GasFeeCap)
|
||||
enc.Value = (*hexutil.Big)(tx.Value)
|
||||
enc.Data = (*hexutil.Bytes)(&tx.Data)
|
||||
enc.To = t.To()
|
||||
enc.RequestId = &itx.RequestId
|
||||
enc.From = (*common.Address)(&itx.From)
|
||||
enc.ChainID = (*hexutil.Big)(itx.ChainId)
|
||||
enc.Gas = (*hexutil.Uint64)(&itx.Gas)
|
||||
enc.MaxFeePerGas = (*hexutil.Big)(itx.GasFeeCap)
|
||||
enc.Value = (*hexutil.Big)(itx.Value)
|
||||
enc.Data = (*hexutil.Bytes)(&itx.Data)
|
||||
enc.To = tx.To()
|
||||
case *ArbitrumRetryTx:
|
||||
enc.From = (*common.Address)(&tx.From)
|
||||
enc.TicketId = &tx.TicketId
|
||||
enc.RefundTo = &tx.RefundTo
|
||||
enc.ChainID = (*hexutil.Big)(tx.ChainId)
|
||||
enc.Nonce = (*hexutil.Uint64)(&tx.Nonce)
|
||||
enc.Gas = (*hexutil.Uint64)(&tx.Gas)
|
||||
enc.MaxFeePerGas = (*hexutil.Big)(tx.GasFeeCap)
|
||||
enc.Value = (*hexutil.Big)(tx.Value)
|
||||
enc.Data = (*hexutil.Bytes)(&tx.Data)
|
||||
enc.MaxRefund = (*hexutil.Big)(tx.MaxRefund)
|
||||
enc.SubmissionFeeRefund = (*hexutil.Big)(tx.SubmissionFeeRefund)
|
||||
enc.To = t.To()
|
||||
enc.From = (*common.Address)(&itx.From)
|
||||
enc.TicketId = &itx.TicketId
|
||||
enc.RefundTo = &itx.RefundTo
|
||||
enc.ChainID = (*hexutil.Big)(itx.ChainId)
|
||||
enc.Nonce = (*hexutil.Uint64)(&itx.Nonce)
|
||||
enc.Gas = (*hexutil.Uint64)(&itx.Gas)
|
||||
enc.MaxFeePerGas = (*hexutil.Big)(itx.GasFeeCap)
|
||||
enc.Value = (*hexutil.Big)(itx.Value)
|
||||
enc.Data = (*hexutil.Bytes)(&itx.Data)
|
||||
enc.MaxRefund = (*hexutil.Big)(itx.MaxRefund)
|
||||
enc.SubmissionFeeRefund = (*hexutil.Big)(itx.SubmissionFeeRefund)
|
||||
enc.To = tx.To()
|
||||
case *ArbitrumSubmitRetryableTx:
|
||||
enc.RequestId = &tx.RequestId
|
||||
enc.From = &tx.From
|
||||
enc.L1BaseFee = (*hexutil.Big)(tx.L1BaseFee)
|
||||
enc.DepositValue = (*hexutil.Big)(tx.DepositValue)
|
||||
enc.Beneficiary = &tx.Beneficiary
|
||||
enc.RefundTo = &tx.FeeRefundAddr
|
||||
enc.MaxSubmissionFee = (*hexutil.Big)(tx.MaxSubmissionFee)
|
||||
enc.ChainID = (*hexutil.Big)(tx.ChainId)
|
||||
enc.Gas = (*hexutil.Uint64)(&tx.Gas)
|
||||
enc.MaxFeePerGas = (*hexutil.Big)(tx.GasFeeCap)
|
||||
enc.RetryTo = tx.RetryTo
|
||||
enc.RetryValue = (*hexutil.Big)(tx.RetryValue)
|
||||
enc.RetryData = (*hexutil.Bytes)(&tx.RetryData)
|
||||
data := tx.data()
|
||||
enc.RequestId = &itx.RequestId
|
||||
enc.From = &itx.From
|
||||
enc.L1BaseFee = (*hexutil.Big)(itx.L1BaseFee)
|
||||
enc.DepositValue = (*hexutil.Big)(itx.DepositValue)
|
||||
enc.Beneficiary = &itx.Beneficiary
|
||||
enc.RefundTo = &itx.FeeRefundAddr
|
||||
enc.MaxSubmissionFee = (*hexutil.Big)(itx.MaxSubmissionFee)
|
||||
enc.ChainID = (*hexutil.Big)(itx.ChainId)
|
||||
enc.Gas = (*hexutil.Uint64)(&itx.Gas)
|
||||
enc.MaxFeePerGas = (*hexutil.Big)(itx.GasFeeCap)
|
||||
enc.RetryTo = itx.RetryTo
|
||||
enc.RetryValue = (*hexutil.Big)(itx.RetryValue)
|
||||
enc.RetryData = (*hexutil.Bytes)(&itx.RetryData)
|
||||
data := itx.data()
|
||||
enc.Data = (*hexutil.Bytes)(&data)
|
||||
enc.To = t.To()
|
||||
enc.To = tx.To()
|
||||
case *OptimismDepositTx:
|
||||
enc.Gas = (*hexutil.Uint64)(&itx.Gas)
|
||||
enc.Value = (*hexutil.Big)(itx.Value)
|
||||
enc.Data = (*hexutil.Bytes)(&itx.Data)
|
||||
enc.To = tx.To()
|
||||
enc.SourceHash = &itx.SourceHash
|
||||
enc.From = &itx.From
|
||||
if itx.Mint != nil {
|
||||
enc.Mint = (*hexutil.Big)(itx.Mint)
|
||||
}
|
||||
enc.IsSystemTx = &itx.IsSystemTransaction
|
||||
// other fields will show up as null.
|
||||
}
|
||||
return json.Marshal(&enc)
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshals from JSON.
|
||||
func (t *Transaction) UnmarshalJSON(input []byte) error {
|
||||
func (tx *Transaction) UnmarshalJSON(input []byte) error {
|
||||
var dec txJSON
|
||||
if err := json.Unmarshal(input, &dec); err != nil {
|
||||
return err
|
||||
|
@ -625,21 +645,72 @@ func (t *Transaction) UnmarshalJSON(input []byte) error {
|
|||
RetryData: *dec.RetryData,
|
||||
}
|
||||
case OptimismDepositTxType:
|
||||
inner = &OptimismDepositTx{
|
||||
ChainID: big.NewInt(0),
|
||||
From: *dec.From,
|
||||
To: *dec.To,
|
||||
Mint: new(big.Int),
|
||||
Value: (*big.Int)(dec.Value),
|
||||
Data: *dec.Data,
|
||||
if dec.AccessList != nil || dec.MaxFeePerGas != nil ||
|
||||
dec.MaxPriorityFeePerGas != nil {
|
||||
return errors.New("unexpected field(s) in deposit transaction")
|
||||
}
|
||||
if dec.GasPrice != nil && dec.GasPrice.ToInt().Cmp(common.Big0) != 0 {
|
||||
return errors.New("deposit transaction GasPrice must be 0")
|
||||
}
|
||||
if (dec.V != nil && dec.V.ToInt().Cmp(common.Big0) != 0) ||
|
||||
(dec.R != nil && dec.R.ToInt().Cmp(common.Big0) != 0) ||
|
||||
(dec.S != nil && dec.S.ToInt().Cmp(common.Big0) != 0) {
|
||||
return errors.New("deposit transaction signature must be 0 or unset")
|
||||
}
|
||||
var itx OptimismDepositTx
|
||||
inner = &itx
|
||||
if dec.To != nil {
|
||||
itx.To = dec.To
|
||||
}
|
||||
if dec.Gas == nil {
|
||||
return errors.New("missing required field 'gas' for txdata")
|
||||
}
|
||||
itx.Gas = uint64(*dec.Gas)
|
||||
if dec.Value == nil {
|
||||
return errors.New("missing required field 'value' in transaction")
|
||||
}
|
||||
itx.Value = (*big.Int)(dec.Value)
|
||||
// mint may be omitted or nil if there is nothing to mint.
|
||||
itx.Mint = (*big.Int)(dec.Mint)
|
||||
if dec.Data == nil {
|
||||
return errors.New("missing required field 'input' in transaction")
|
||||
}
|
||||
itx.Data = *dec.Data
|
||||
if dec.From == nil {
|
||||
return errors.New("missing required field 'from' in transaction")
|
||||
}
|
||||
itx.From = *dec.From
|
||||
if dec.SourceHash == nil {
|
||||
return errors.New("missing required field 'sourceHash' in transaction")
|
||||
}
|
||||
itx.SourceHash = *dec.SourceHash
|
||||
// IsSystemTx may be omitted. Defaults to false.
|
||||
if dec.IsSystemTx != nil {
|
||||
itx.IsSystemTransaction = *dec.IsSystemTx
|
||||
}
|
||||
|
||||
if dec.Nonce != nil {
|
||||
inner = &optimismDepositTxWithNonce{OptimismDepositTx: itx, EffectiveNonce: uint64(*dec.Nonce)}
|
||||
}
|
||||
default:
|
||||
return ErrTxTypeNotSupported
|
||||
}
|
||||
|
||||
// Now set the inner transaction.
|
||||
t.setDecoded(inner, 0)
|
||||
tx.setDecoded(inner, 0)
|
||||
|
||||
// TODO: check hash here?
|
||||
return nil
|
||||
}
|
||||
|
||||
type optimismDepositTxWithNonce struct {
|
||||
OptimismDepositTx
|
||||
EffectiveNonce uint64
|
||||
}
|
||||
|
||||
// EncodeRLP ensures that RLP encoding this transaction excludes the nonce. Otherwise, the tx Hash would change
|
||||
func (tx *optimismDepositTxWithNonce) EncodeRLP(w io.Writer) error {
|
||||
return rlp.Encode(w, tx.OptimismDepositTx)
|
||||
}
|
||||
|
||||
func (tx *optimismDepositTxWithNonce) effectiveNonce() *uint64 { return &tx.EffectiveNonce }
|
||||
|
|
|
@ -51,6 +51,7 @@ func MakeSigner(config *params.ChainConfig, blockNumber *big.Int) Signer {
|
|||
default:
|
||||
signer = FrontierSigner{}
|
||||
}
|
||||
signer = NewArbitrumSigner(signer)
|
||||
return signer
|
||||
}
|
||||
|
||||
|
@ -61,7 +62,7 @@ func MakeSigner(config *params.ChainConfig, blockNumber *big.Int) Signer {
|
|||
//
|
||||
// Use this in transaction-handling code where the current block number is unknown. If you
|
||||
// have the current block number available, use MakeSigner instead.
|
||||
func LatestSigner(config *params.ChainConfig) Signer {
|
||||
func latestSignerImpl(config *params.ChainConfig) Signer {
|
||||
if config.ChainID != nil {
|
||||
if config.LondonBlock != nil {
|
||||
return NewLondonSigner(config.ChainID)
|
||||
|
@ -76,6 +77,10 @@ func LatestSigner(config *params.ChainConfig) Signer {
|
|||
return HomesteadSigner{}
|
||||
}
|
||||
|
||||
func LatestSigner(config *params.ChainConfig) Signer {
|
||||
return NewArbitrumSigner(latestSignerImpl(config))
|
||||
}
|
||||
|
||||
// LatestSignerForChainID returns the 'most permissive' Signer available. Specifically,
|
||||
// this enables support for EIP-155 replay protection and all implemented EIP-2718
|
||||
// transaction types if chainID is non-nil.
|
||||
|
@ -83,13 +88,17 @@ func LatestSigner(config *params.ChainConfig) Signer {
|
|||
// Use this in transaction-handling code where the current block number and fork
|
||||
// configuration are unknown. If you have a ChainConfig, use LatestSigner instead.
|
||||
// If you have a ChainConfig and know the current block number, use MakeSigner instead.
|
||||
func LatestSignerForChainID(chainID *big.Int) Signer {
|
||||
func latestSignerForChainIDImpl(chainID *big.Int) Signer {
|
||||
if chainID == nil {
|
||||
return HomesteadSigner{}
|
||||
}
|
||||
return NewLondonSigner(chainID)
|
||||
}
|
||||
|
||||
func LatestSignerForChainID(chainID *big.Int) Signer {
|
||||
return NewArbitrumSigner(latestSignerForChainIDImpl(chainID))
|
||||
}
|
||||
|
||||
// SignTx signs the transaction using the given signer and private key.
|
||||
func SignTx(tx *Transaction, s Signer, prv *ecdsa.PrivateKey) (*Transaction, error) {
|
||||
h := s.Hash(tx)
|
||||
|
@ -182,6 +191,14 @@ func NewLondonSigner(chainId *big.Int) Signer {
|
|||
}
|
||||
|
||||
func (s londonSigner) Sender(tx *Transaction) (common.Address, error) {
|
||||
if tx.Type() == OptimismDepositTxType {
|
||||
switch tx.inner.(type) {
|
||||
case *OptimismDepositTx:
|
||||
return tx.inner.(*OptimismDepositTx).From, nil
|
||||
case *optimismDepositTxWithNonce:
|
||||
return tx.inner.(*optimismDepositTxWithNonce).From, nil
|
||||
}
|
||||
}
|
||||
if tx.Type() != DynamicFeeTxType {
|
||||
return s.eip2930Signer.Sender(tx)
|
||||
}
|
||||
|
@ -201,6 +218,9 @@ func (s londonSigner) Equal(s2 Signer) bool {
|
|||
}
|
||||
|
||||
func (s londonSigner) SignatureValues(tx *Transaction, sig []byte) (R, S, V *big.Int, err error) {
|
||||
if tx.Type() == OptimismDepositTxType {
|
||||
return nil, nil, nil, fmt.Errorf("deposits do not have a signature")
|
||||
}
|
||||
txdata, ok := tx.inner.(*DynamicFeeTx)
|
||||
if !ok {
|
||||
return s.eip2930Signer.SignatureValues(tx, sig)
|
||||
|
@ -218,6 +238,9 @@ func (s londonSigner) SignatureValues(tx *Transaction, sig []byte) (R, S, V *big
|
|||
// Hash returns the hash to be signed by the sender.
|
||||
// It does not uniquely identify the transaction.
|
||||
func (s londonSigner) Hash(tx *Transaction) common.Hash {
|
||||
if tx.Type() == OptimismDepositTxType {
|
||||
panic("deposits cannot be signed and do not have a signing hash")
|
||||
}
|
||||
if tx.Type() != DynamicFeeTxType {
|
||||
return s.eip2930Signer.Hash(tx)
|
||||
}
|
||||
|
|
|
@ -105,6 +105,11 @@ func (tx *AccessListTx) gasFeeCap() *big.Int { return tx.GasPrice }
|
|||
func (tx *AccessListTx) value() *big.Int { return tx.Value }
|
||||
func (tx *AccessListTx) nonce() uint64 { return tx.Nonce }
|
||||
func (tx *AccessListTx) to() *common.Address { return tx.To }
|
||||
func (tx *AccessListTx) isSystemTx() bool { return false }
|
||||
|
||||
func (tx *AccessListTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int {
|
||||
return dst.Set(tx.GasPrice)
|
||||
}
|
||||
|
||||
func (tx *AccessListTx) rawSignatureValues() (v, r, s *big.Int) {
|
||||
return tx.V, tx.R, tx.S
|
|
@ -93,6 +93,18 @@ func (tx *DynamicFeeTx) gasPrice() *big.Int { return tx.GasFeeCap }
|
|||
func (tx *DynamicFeeTx) value() *big.Int { return tx.Value }
|
||||
func (tx *DynamicFeeTx) nonce() uint64 { return tx.Nonce }
|
||||
func (tx *DynamicFeeTx) to() *common.Address { return tx.To }
|
||||
func (tx *DynamicFeeTx) isSystemTx() bool { return false }
|
||||
|
||||
func (tx *DynamicFeeTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int {
|
||||
if baseFee == nil {
|
||||
return dst.Set(tx.GasFeeCap)
|
||||
}
|
||||
tip := dst.Sub(tx.GasFeeCap, baseFee)
|
||||
if tip.Cmp(tx.GasTipCap) > 0 {
|
||||
tip.Set(tx.GasTipCap)
|
||||
}
|
||||
return tip.Add(tip, baseFee)
|
||||
}
|
||||
|
||||
func (tx *DynamicFeeTx) rawSignatureValues() (v, r, s *big.Int) {
|
||||
return tx.V, tx.R, tx.S
|
|
@ -102,6 +102,11 @@ func (tx *LegacyTx) gasFeeCap() *big.Int { return tx.GasPrice }
|
|||
func (tx *LegacyTx) value() *big.Int { return tx.Value }
|
||||
func (tx *LegacyTx) nonce() uint64 { return tx.Nonce }
|
||||
func (tx *LegacyTx) to() *common.Address { return tx.To }
|
||||
func (tx *LegacyTx) isSystemTx() bool { return false }
|
||||
|
||||
func (tx *LegacyTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int {
|
||||
return dst.Set(tx.GasPrice)
|
||||
}
|
||||
|
||||
func (tx *LegacyTx) rawSignatureValues() (v, r, s *big.Int) {
|
||||
return tx.V, tx.R, tx.S
|
|
@ -0,0 +1,56 @@
|
|||
// Copyright 2022 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
)
|
||||
|
||||
//go:generate go run github.com/fjl/gencodec -type Withdrawal -field-override withdrawalMarshaling -out gen_withdrawal_json.go
|
||||
//go:generate go run ../../rlp/rlpgen -type Withdrawal -out gen_withdrawal_rlp.go
|
||||
|
||||
// Withdrawal represents a validator withdrawal from the consensus layer.
|
||||
type Withdrawal struct {
|
||||
Index uint64 `json:"index"` // monotonically increasing identifier issued by consensus layer
|
||||
Validator uint64 `json:"validatorIndex"` // index of validator associated with withdrawal
|
||||
Address common.Address `json:"address"` // target address for withdrawn ether
|
||||
Amount uint64 `json:"amount"` // value of withdrawal in Gwei
|
||||
}
|
||||
|
||||
// field type overrides for gencodec
|
||||
type withdrawalMarshaling struct {
|
||||
Index hexutil.Uint64
|
||||
Validator hexutil.Uint64
|
||||
Amount hexutil.Uint64
|
||||
}
|
||||
|
||||
// Withdrawals implements DerivableList for withdrawals.
|
||||
type Withdrawals []*Withdrawal
|
||||
|
||||
// Len returns the length of s.
|
||||
func (s Withdrawals) Len() int { return len(s) }
|
||||
|
||||
// EncodeIndex encodes the i'th withdrawal to w. Note that this does not check for errors
|
||||
// because we assume that *Withdrawal will only ever contain valid withdrawals that were either
|
||||
// constructed by decoding or via public API in this package.
|
||||
func (s Withdrawals) EncodeIndex(i int, w *bytes.Buffer) {
|
||||
rlp.Encode(w, s[i])
|
||||
}
|
|
@ -1,150 +0,0 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2015 Pieter Wuille *
|
||||
* Distributed under the MIT software license, see the accompanying *
|
||||
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
|
||||
**********************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <secp256k1.h>
|
||||
|
||||
#include "lax_der_parsing.h"
|
||||
|
||||
int ecdsa_signature_parse_der_lax(const secp256k1_context* ctx, secp256k1_ecdsa_signature* sig, const unsigned char *input, size_t inputlen) {
|
||||
size_t rpos, rlen, spos, slen;
|
||||
size_t pos = 0;
|
||||
size_t lenbyte;
|
||||
unsigned char tmpsig[64] = {0};
|
||||
int overflow = 0;
|
||||
|
||||
/* Hack to initialize sig with a correctly-parsed but invalid signature. */
|
||||
secp256k1_ecdsa_signature_parse_compact(ctx, sig, tmpsig);
|
||||
|
||||
/* Sequence tag byte */
|
||||
if (pos == inputlen || input[pos] != 0x30) {
|
||||
return 0;
|
||||
}
|
||||
pos++;
|
||||
|
||||
/* Sequence length bytes */
|
||||
if (pos == inputlen) {
|
||||
return 0;
|
||||
}
|
||||
lenbyte = input[pos++];
|
||||
if (lenbyte & 0x80) {
|
||||
lenbyte -= 0x80;
|
||||
if (pos + lenbyte > inputlen) {
|
||||
return 0;
|
||||
}
|
||||
pos += lenbyte;
|
||||
}
|
||||
|
||||
/* Integer tag byte for R */
|
||||
if (pos == inputlen || input[pos] != 0x02) {
|
||||
return 0;
|
||||
}
|
||||
pos++;
|
||||
|
||||
/* Integer length for R */
|
||||
if (pos == inputlen) {
|
||||
return 0;
|
||||
}
|
||||
lenbyte = input[pos++];
|
||||
if (lenbyte & 0x80) {
|
||||
lenbyte -= 0x80;
|
||||
if (pos + lenbyte > inputlen) {
|
||||
return 0;
|
||||
}
|
||||
while (lenbyte > 0 && input[pos] == 0) {
|
||||
pos++;
|
||||
lenbyte--;
|
||||
}
|
||||
if (lenbyte >= sizeof(size_t)) {
|
||||
return 0;
|
||||
}
|
||||
rlen = 0;
|
||||
while (lenbyte > 0) {
|
||||
rlen = (rlen << 8) + input[pos];
|
||||
pos++;
|
||||
lenbyte--;
|
||||
}
|
||||
} else {
|
||||
rlen = lenbyte;
|
||||
}
|
||||
if (rlen > inputlen - pos) {
|
||||
return 0;
|
||||
}
|
||||
rpos = pos;
|
||||
pos += rlen;
|
||||
|
||||
/* Integer tag byte for S */
|
||||
if (pos == inputlen || input[pos] != 0x02) {
|
||||
return 0;
|
||||
}
|
||||
pos++;
|
||||
|
||||
/* Integer length for S */
|
||||
if (pos == inputlen) {
|
||||
return 0;
|
||||
}
|
||||
lenbyte = input[pos++];
|
||||
if (lenbyte & 0x80) {
|
||||
lenbyte -= 0x80;
|
||||
if (pos + lenbyte > inputlen) {
|
||||
return 0;
|
||||
}
|
||||
while (lenbyte > 0 && input[pos] == 0) {
|
||||
pos++;
|
||||
lenbyte--;
|
||||
}
|
||||
if (lenbyte >= sizeof(size_t)) {
|
||||
return 0;
|
||||
}
|
||||
slen = 0;
|
||||
while (lenbyte > 0) {
|
||||
slen = (slen << 8) + input[pos];
|
||||
pos++;
|
||||
lenbyte--;
|
||||
}
|
||||
} else {
|
||||
slen = lenbyte;
|
||||
}
|
||||
if (slen > inputlen - pos) {
|
||||
return 0;
|
||||
}
|
||||
spos = pos;
|
||||
pos += slen;
|
||||
|
||||
/* Ignore leading zeroes in R */
|
||||
while (rlen > 0 && input[rpos] == 0) {
|
||||
rlen--;
|
||||
rpos++;
|
||||
}
|
||||
/* Copy R value */
|
||||
if (rlen > 32) {
|
||||
overflow = 1;
|
||||
} else {
|
||||
memcpy(tmpsig + 32 - rlen, input + rpos, rlen);
|
||||
}
|
||||
|
||||
/* Ignore leading zeroes in S */
|
||||
while (slen > 0 && input[spos] == 0) {
|
||||
slen--;
|
||||
spos++;
|
||||
}
|
||||
/* Copy S value */
|
||||
if (slen > 32) {
|
||||
overflow = 1;
|
||||
} else {
|
||||
memcpy(tmpsig + 64 - slen, input + spos, slen);
|
||||
}
|
||||
|
||||
if (!overflow) {
|
||||
overflow = !secp256k1_ecdsa_signature_parse_compact(ctx, sig, tmpsig);
|
||||
}
|
||||
if (overflow) {
|
||||
memset(tmpsig, 0, 64);
|
||||
secp256k1_ecdsa_signature_parse_compact(ctx, sig, tmpsig);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2015 Pieter Wuille *
|
||||
* Distributed under the MIT software license, see the accompanying *
|
||||
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
|
||||
**********************************************************************/
|
||||
|
||||
/****
|
||||
* Please do not link this file directly. It is not part of the libsecp256k1
|
||||
* project and does not promise any stability in its API, functionality or
|
||||
* presence. Projects which use this code should instead copy this header
|
||||
* and its accompanying .c file directly into their codebase.
|
||||
****/
|
||||
|
||||
/* This file defines a function that parses DER with various errors and
|
||||
* violations. This is not a part of the library itself, because the allowed
|
||||
* violations are chosen arbitrarily and do not follow or establish any
|
||||
* standard.
|
||||
*
|
||||
* In many places it matters that different implementations do not only accept
|
||||
* the same set of valid signatures, but also reject the same set of signatures.
|
||||
* The only means to accomplish that is by strictly obeying a standard, and not
|
||||
* accepting anything else.
|
||||
*
|
||||
* Nonetheless, sometimes there is a need for compatibility with systems that
|
||||
* use signatures which do not strictly obey DER. The snippet below shows how
|
||||
* certain violations are easily supported. You may need to adapt it.
|
||||
*
|
||||
* Do not use this for new systems. Use well-defined DER or compact signatures
|
||||
* instead if you have the choice (see secp256k1_ecdsa_signature_parse_der and
|
||||
* secp256k1_ecdsa_signature_parse_compact).
|
||||
*
|
||||
* The supported violations are:
|
||||
* - All numbers are parsed as nonnegative integers, even though X.609-0207
|
||||
* section 8.3.3 specifies that integers are always encoded as two's
|
||||
* complement.
|
||||
* - Integers can have length 0, even though section 8.3.1 says they can't.
|
||||
* - Integers with overly long padding are accepted, violation section
|
||||
* 8.3.2.
|
||||
* - 127-byte long length descriptors are accepted, even though section
|
||||
* 8.1.3.5.c says that they are not.
|
||||
* - Trailing garbage data inside or after the signature is ignored.
|
||||
* - The length descriptor of the sequence is ignored.
|
||||
*
|
||||
* Compared to for example OpenSSL, many violations are NOT supported:
|
||||
* - Using overly long tag descriptors for the sequence or integers inside,
|
||||
* violating section 8.1.2.2.
|
||||
* - Encoding primitive integers as constructed values, violating section
|
||||
* 8.3.1.
|
||||
*/
|
||||
|
||||
#ifndef _SECP256K1_CONTRIB_LAX_DER_PARSING_H_
|
||||
#define _SECP256K1_CONTRIB_LAX_DER_PARSING_H_
|
||||
|
||||
#include <secp256k1.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
/** Parse a signature in "lax DER" format
|
||||
*
|
||||
* Returns: 1 when the signature could be parsed, 0 otherwise.
|
||||
* Args: ctx: a secp256k1 context object
|
||||
* Out: sig: a pointer to a signature object
|
||||
* In: input: a pointer to the signature to be parsed
|
||||
* inputlen: the length of the array pointed to be input
|
||||
*
|
||||
* This function will accept any valid DER encoded signature, even if the
|
||||
* encoded numbers are out of range. In addition, it will accept signatures
|
||||
* which violate the DER spec in various ways. Its purpose is to allow
|
||||
* validation of the Bitcoin blockchain, which includes non-DER signatures
|
||||
* from before the network rules were updated to enforce DER. Note that
|
||||
* the set of supported violations is a strict subset of what OpenSSL will
|
||||
* accept.
|
||||
*
|
||||
* After the call, sig will always be initialized. If parsing failed or the
|
||||
* encoded numbers are out of range, signature validation with it is
|
||||
* guaranteed to fail for every message and public key.
|
||||
*/
|
||||
int ecdsa_signature_parse_der_lax(
|
||||
const secp256k1_context* ctx,
|
||||
secp256k1_ecdsa_signature* sig,
|
||||
const unsigned char *input,
|
||||
size_t inputlen
|
||||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,113 +0,0 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2014, 2015 Pieter Wuille *
|
||||
* Distributed under the MIT software license, see the accompanying *
|
||||
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
|
||||
**********************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <secp256k1.h>
|
||||
|
||||
#include "lax_der_privatekey_parsing.h"
|
||||
|
||||
int ec_privkey_import_der(const secp256k1_context* ctx, unsigned char *out32, const unsigned char *privkey, size_t privkeylen) {
|
||||
const unsigned char *end = privkey + privkeylen;
|
||||
int lenb = 0;
|
||||
int len = 0;
|
||||
memset(out32, 0, 32);
|
||||
/* sequence header */
|
||||
if (end < privkey+1 || *privkey != 0x30) {
|
||||
return 0;
|
||||
}
|
||||
privkey++;
|
||||
/* sequence length constructor */
|
||||
if (end < privkey+1 || !(*privkey & 0x80)) {
|
||||
return 0;
|
||||
}
|
||||
lenb = *privkey & ~0x80; privkey++;
|
||||
if (lenb < 1 || lenb > 2) {
|
||||
return 0;
|
||||
}
|
||||
if (end < privkey+lenb) {
|
||||
return 0;
|
||||
}
|
||||
/* sequence length */
|
||||
len = privkey[lenb-1] | (lenb > 1 ? privkey[lenb-2] << 8 : 0);
|
||||
privkey += lenb;
|
||||
if (end < privkey+len) {
|
||||
return 0;
|
||||
}
|
||||
/* sequence element 0: version number (=1) */
|
||||
if (end < privkey+3 || privkey[0] != 0x02 || privkey[1] != 0x01 || privkey[2] != 0x01) {
|
||||
return 0;
|
||||
}
|
||||
privkey += 3;
|
||||
/* sequence element 1: octet string, up to 32 bytes */
|
||||
if (end < privkey+2 || privkey[0] != 0x04 || privkey[1] > 0x20 || end < privkey+2+privkey[1]) {
|
||||
return 0;
|
||||
}
|
||||
memcpy(out32 + 32 - privkey[1], privkey + 2, privkey[1]);
|
||||
if (!secp256k1_ec_seckey_verify(ctx, out32)) {
|
||||
memset(out32, 0, 32);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ec_privkey_export_der(const secp256k1_context *ctx, unsigned char *privkey, size_t *privkeylen, const unsigned char *key32, int compressed) {
|
||||
secp256k1_pubkey pubkey;
|
||||
size_t pubkeylen = 0;
|
||||
if (!secp256k1_ec_pubkey_create(ctx, &pubkey, key32)) {
|
||||
*privkeylen = 0;
|
||||
return 0;
|
||||
}
|
||||
if (compressed) {
|
||||
static const unsigned char begin[] = {
|
||||
0x30,0x81,0xD3,0x02,0x01,0x01,0x04,0x20
|
||||
};
|
||||
static const unsigned char middle[] = {
|
||||
0xA0,0x81,0x85,0x30,0x81,0x82,0x02,0x01,0x01,0x30,0x2C,0x06,0x07,0x2A,0x86,0x48,
|
||||
0xCE,0x3D,0x01,0x01,0x02,0x21,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
0xFF,0xFF,0xFE,0xFF,0xFF,0xFC,0x2F,0x30,0x06,0x04,0x01,0x00,0x04,0x01,0x07,0x04,
|
||||
0x21,0x02,0x79,0xBE,0x66,0x7E,0xF9,0xDC,0xBB,0xAC,0x55,0xA0,0x62,0x95,0xCE,0x87,
|
||||
0x0B,0x07,0x02,0x9B,0xFC,0xDB,0x2D,0xCE,0x28,0xD9,0x59,0xF2,0x81,0x5B,0x16,0xF8,
|
||||
0x17,0x98,0x02,0x21,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
0xFF,0xFF,0xFF,0xFF,0xFE,0xBA,0xAE,0xDC,0xE6,0xAF,0x48,0xA0,0x3B,0xBF,0xD2,0x5E,
|
||||
0x8C,0xD0,0x36,0x41,0x41,0x02,0x01,0x01,0xA1,0x24,0x03,0x22,0x00
|
||||
};
|
||||
unsigned char *ptr = privkey;
|
||||
memcpy(ptr, begin, sizeof(begin)); ptr += sizeof(begin);
|
||||
memcpy(ptr, key32, 32); ptr += 32;
|
||||
memcpy(ptr, middle, sizeof(middle)); ptr += sizeof(middle);
|
||||
pubkeylen = 33;
|
||||
secp256k1_ec_pubkey_serialize(ctx, ptr, &pubkeylen, &pubkey, SECP256K1_EC_COMPRESSED);
|
||||
ptr += pubkeylen;
|
||||
*privkeylen = ptr - privkey;
|
||||
} else {
|
||||
static const unsigned char begin[] = {
|
||||
0x30,0x82,0x01,0x13,0x02,0x01,0x01,0x04,0x20
|
||||
};
|
||||
static const unsigned char middle[] = {
|
||||
0xA0,0x81,0xA5,0x30,0x81,0xA2,0x02,0x01,0x01,0x30,0x2C,0x06,0x07,0x2A,0x86,0x48,
|
||||
0xCE,0x3D,0x01,0x01,0x02,0x21,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
0xFF,0xFF,0xFE,0xFF,0xFF,0xFC,0x2F,0x30,0x06,0x04,0x01,0x00,0x04,0x01,0x07,0x04,
|
||||
0x41,0x04,0x79,0xBE,0x66,0x7E,0xF9,0xDC,0xBB,0xAC,0x55,0xA0,0x62,0x95,0xCE,0x87,
|
||||
0x0B,0x07,0x02,0x9B,0xFC,0xDB,0x2D,0xCE,0x28,0xD9,0x59,0xF2,0x81,0x5B,0x16,0xF8,
|
||||
0x17,0x98,0x48,0x3A,0xDA,0x77,0x26,0xA3,0xC4,0x65,0x5D,0xA4,0xFB,0xFC,0x0E,0x11,
|
||||
0x08,0xA8,0xFD,0x17,0xB4,0x48,0xA6,0x85,0x54,0x19,0x9C,0x47,0xD0,0x8F,0xFB,0x10,
|
||||
0xD4,0xB8,0x02,0x21,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
0xFF,0xFF,0xFF,0xFF,0xFE,0xBA,0xAE,0xDC,0xE6,0xAF,0x48,0xA0,0x3B,0xBF,0xD2,0x5E,
|
||||
0x8C,0xD0,0x36,0x41,0x41,0x02,0x01,0x01,0xA1,0x44,0x03,0x42,0x00
|
||||
};
|
||||
unsigned char *ptr = privkey;
|
||||
memcpy(ptr, begin, sizeof(begin)); ptr += sizeof(begin);
|
||||
memcpy(ptr, key32, 32); ptr += 32;
|
||||
memcpy(ptr, middle, sizeof(middle)); ptr += sizeof(middle);
|
||||
pubkeylen = 65;
|
||||
secp256k1_ec_pubkey_serialize(ctx, ptr, &pubkeylen, &pubkey, SECP256K1_EC_UNCOMPRESSED);
|
||||
ptr += pubkeylen;
|
||||
*privkeylen = ptr - privkey;
|
||||
}
|
||||
return 1;
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2014, 2015 Pieter Wuille *
|
||||
* Distributed under the MIT software license, see the accompanying *
|
||||
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
|
||||
**********************************************************************/
|
||||
|
||||
/****
|
||||
* Please do not link this file directly. It is not part of the libsecp256k1
|
||||
* project and does not promise any stability in its API, functionality or
|
||||
* presence. Projects which use this code should instead copy this header
|
||||
* and its accompanying .c file directly into their codebase.
|
||||
****/
|
||||
|
||||
/* This file contains code snippets that parse DER private keys with
|
||||
* various errors and violations. This is not a part of the library
|
||||
* itself, because the allowed violations are chosen arbitrarily and
|
||||
* do not follow or establish any standard.
|
||||
*
|
||||
* It also contains code to serialize private keys in a compatible
|
||||
* manner.
|
||||
*
|
||||
* These functions are meant for compatibility with applications
|
||||
* that require BER encoded keys. When working with secp256k1-specific
|
||||
* code, the simple 32-byte private keys normally used by the
|
||||
* library are sufficient.
|
||||
*/
|
||||
|
||||
#ifndef _SECP256K1_CONTRIB_BER_PRIVATEKEY_H_
|
||||
#define _SECP256K1_CONTRIB_BER_PRIVATEKEY_H_
|
||||
|
||||
#include <secp256k1.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
/** Export a private key in DER format.
|
||||
*
|
||||
* Returns: 1 if the private key was valid.
|
||||
* Args: ctx: pointer to a context object, initialized for signing (cannot
|
||||
* be NULL)
|
||||
* Out: privkey: pointer to an array for storing the private key in BER.
|
||||
* Should have space for 279 bytes, and cannot be NULL.
|
||||
* privkeylen: Pointer to an int where the length of the private key in
|
||||
* privkey will be stored.
|
||||
* In: seckey: pointer to a 32-byte secret key to export.
|
||||
* compressed: 1 if the key should be exported in
|
||||
* compressed format, 0 otherwise
|
||||
*
|
||||
* This function is purely meant for compatibility with applications that
|
||||
* require BER encoded keys. When working with secp256k1-specific code, the
|
||||
* simple 32-byte private keys are sufficient.
|
||||
*
|
||||
* Note that this function does not guarantee correct DER output. It is
|
||||
* guaranteed to be parsable by secp256k1_ec_privkey_import_der
|
||||
*/
|
||||
SECP256K1_WARN_UNUSED_RESULT int ec_privkey_export_der(
|
||||
const secp256k1_context* ctx,
|
||||
unsigned char *privkey,
|
||||
size_t *privkeylen,
|
||||
const unsigned char *seckey,
|
||||
int compressed
|
||||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4);
|
||||
|
||||
/** Import a private key in DER format.
|
||||
* Returns: 1 if a private key was extracted.
|
||||
* Args: ctx: pointer to a context object (cannot be NULL).
|
||||
* Out: seckey: pointer to a 32-byte array for storing the private key.
|
||||
* (cannot be NULL).
|
||||
* In: privkey: pointer to a private key in DER format (cannot be NULL).
|
||||
* privkeylen: length of the DER private key pointed to be privkey.
|
||||
*
|
||||
* This function will accept more than just strict DER, and even allow some BER
|
||||
* violations. The public key stored inside the DER-encoded private key is not
|
||||
* verified for correctness, nor are the curve parameters. Use this function
|
||||
* only if you know in advance it is supposed to contain a secp256k1 private
|
||||
* key.
|
||||
*/
|
||||
SECP256K1_WARN_UNUSED_RESULT int ec_privkey_import_der(
|
||||
const secp256k1_context* ctx,
|
||||
unsigned char *seckey,
|
||||
const unsigned char *privkey,
|
||||
size_t privkeylen
|
||||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,377 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "org_bitcoin_NativeSecp256k1.h"
|
||||
#include "include/secp256k1.h"
|
||||
#include "include/secp256k1_ecdh.h"
|
||||
#include "include/secp256k1_recovery.h"
|
||||
|
||||
|
||||
SECP256K1_API jlong JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ctx_1clone
|
||||
(JNIEnv* env, jclass classObject, jlong ctx_l)
|
||||
{
|
||||
const secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l;
|
||||
|
||||
jlong ctx_clone_l = (uintptr_t) secp256k1_context_clone(ctx);
|
||||
|
||||
(void)classObject;(void)env;
|
||||
|
||||
return ctx_clone_l;
|
||||
|
||||
}
|
||||
|
||||
SECP256K1_API jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1context_1randomize
|
||||
(JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l)
|
||||
{
|
||||
secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l;
|
||||
|
||||
const unsigned char* seed = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject);
|
||||
|
||||
(void)classObject;
|
||||
|
||||
return secp256k1_context_randomize(ctx, seed);
|
||||
|
||||
}
|
||||
|
||||
SECP256K1_API void JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1destroy_1context
|
||||
(JNIEnv* env, jclass classObject, jlong ctx_l)
|
||||
{
|
||||
secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l;
|
||||
|
||||
secp256k1_context_destroy(ctx);
|
||||
|
||||
(void)classObject;(void)env;
|
||||
}
|
||||
|
||||
SECP256K1_API jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdsa_1verify
|
||||
(JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l, jint siglen, jint publen)
|
||||
{
|
||||
secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l;
|
||||
|
||||
unsigned char* data = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject);
|
||||
const unsigned char* sigdata = { (unsigned char*) (data + 32) };
|
||||
const unsigned char* pubdata = { (unsigned char*) (data + siglen + 32) };
|
||||
|
||||
secp256k1_ecdsa_signature sig;
|
||||
secp256k1_pubkey pubkey;
|
||||
|
||||
int ret = secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigdata, siglen);
|
||||
|
||||
if( ret ) {
|
||||
ret = secp256k1_ec_pubkey_parse(ctx, &pubkey, pubdata, publen);
|
||||
|
||||
if( ret ) {
|
||||
ret = secp256k1_ecdsa_verify(ctx, &sig, data, &pubkey);
|
||||
}
|
||||
}
|
||||
|
||||
(void)classObject;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdsa_1sign
|
||||
(JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l)
|
||||
{
|
||||
secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l;
|
||||
unsigned char* data = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject);
|
||||
unsigned char* secKey = (unsigned char*) (data + 32);
|
||||
|
||||
jobjectArray retArray;
|
||||
jbyteArray sigArray, intsByteArray;
|
||||
unsigned char intsarray[2];
|
||||
|
||||
secp256k1_ecdsa_signature sig[72];
|
||||
|
||||
int ret = secp256k1_ecdsa_sign(ctx, sig, data, secKey, NULL, NULL );
|
||||
|
||||
unsigned char outputSer[72];
|
||||
size_t outputLen = 72;
|
||||
|
||||
if( ret ) {
|
||||
int ret2 = secp256k1_ecdsa_signature_serialize_der(ctx,outputSer, &outputLen, sig ); (void)ret2;
|
||||
}
|
||||
|
||||
intsarray[0] = outputLen;
|
||||
intsarray[1] = ret;
|
||||
|
||||
retArray = (*env)->NewObjectArray(env, 2,
|
||||
(*env)->FindClass(env, "[B"),
|
||||
(*env)->NewByteArray(env, 1));
|
||||
|
||||
sigArray = (*env)->NewByteArray(env, outputLen);
|
||||
(*env)->SetByteArrayRegion(env, sigArray, 0, outputLen, (jbyte*)outputSer);
|
||||
(*env)->SetObjectArrayElement(env, retArray, 0, sigArray);
|
||||
|
||||
intsByteArray = (*env)->NewByteArray(env, 2);
|
||||
(*env)->SetByteArrayRegion(env, intsByteArray, 0, 2, (jbyte*)intsarray);
|
||||
(*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray);
|
||||
|
||||
(void)classObject;
|
||||
|
||||
return retArray;
|
||||
}
|
||||
|
||||
SECP256K1_API jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ec_1seckey_1verify
|
||||
(JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l)
|
||||
{
|
||||
secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l;
|
||||
unsigned char* secKey = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject);
|
||||
|
||||
(void)classObject;
|
||||
|
||||
return secp256k1_ec_seckey_verify(ctx, secKey);
|
||||
}
|
||||
|
||||
SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ec_1pubkey_1create
|
||||
(JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l)
|
||||
{
|
||||
secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l;
|
||||
const unsigned char* secKey = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject);
|
||||
|
||||
secp256k1_pubkey pubkey;
|
||||
|
||||
jobjectArray retArray;
|
||||
jbyteArray pubkeyArray, intsByteArray;
|
||||
unsigned char intsarray[2];
|
||||
|
||||
int ret = secp256k1_ec_pubkey_create(ctx, &pubkey, secKey);
|
||||
|
||||
unsigned char outputSer[65];
|
||||
size_t outputLen = 65;
|
||||
|
||||
if( ret ) {
|
||||
int ret2 = secp256k1_ec_pubkey_serialize(ctx,outputSer, &outputLen, &pubkey,SECP256K1_EC_UNCOMPRESSED );(void)ret2;
|
||||
}
|
||||
|
||||
intsarray[0] = outputLen;
|
||||
intsarray[1] = ret;
|
||||
|
||||
retArray = (*env)->NewObjectArray(env, 2,
|
||||
(*env)->FindClass(env, "[B"),
|
||||
(*env)->NewByteArray(env, 1));
|
||||
|
||||
pubkeyArray = (*env)->NewByteArray(env, outputLen);
|
||||
(*env)->SetByteArrayRegion(env, pubkeyArray, 0, outputLen, (jbyte*)outputSer);
|
||||
(*env)->SetObjectArrayElement(env, retArray, 0, pubkeyArray);
|
||||
|
||||
intsByteArray = (*env)->NewByteArray(env, 2);
|
||||
(*env)->SetByteArrayRegion(env, intsByteArray, 0, 2, (jbyte*)intsarray);
|
||||
(*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray);
|
||||
|
||||
(void)classObject;
|
||||
|
||||
return retArray;
|
||||
|
||||
}
|
||||
|
||||
SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1privkey_1tweak_1add
|
||||
(JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l)
|
||||
{
|
||||
secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l;
|
||||
unsigned char* privkey = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject);
|
||||
const unsigned char* tweak = (unsigned char*) (privkey + 32);
|
||||
|
||||
jobjectArray retArray;
|
||||
jbyteArray privArray, intsByteArray;
|
||||
unsigned char intsarray[2];
|
||||
|
||||
int privkeylen = 32;
|
||||
|
||||
int ret = secp256k1_ec_privkey_tweak_add(ctx, privkey, tweak);
|
||||
|
||||
intsarray[0] = privkeylen;
|
||||
intsarray[1] = ret;
|
||||
|
||||
retArray = (*env)->NewObjectArray(env, 2,
|
||||
(*env)->FindClass(env, "[B"),
|
||||
(*env)->NewByteArray(env, 1));
|
||||
|
||||
privArray = (*env)->NewByteArray(env, privkeylen);
|
||||
(*env)->SetByteArrayRegion(env, privArray, 0, privkeylen, (jbyte*)privkey);
|
||||
(*env)->SetObjectArrayElement(env, retArray, 0, privArray);
|
||||
|
||||
intsByteArray = (*env)->NewByteArray(env, 2);
|
||||
(*env)->SetByteArrayRegion(env, intsByteArray, 0, 2, (jbyte*)intsarray);
|
||||
(*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray);
|
||||
|
||||
(void)classObject;
|
||||
|
||||
return retArray;
|
||||
}
|
||||
|
||||
SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1privkey_1tweak_1mul
|
||||
(JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l)
|
||||
{
|
||||
secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l;
|
||||
unsigned char* privkey = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject);
|
||||
const unsigned char* tweak = (unsigned char*) (privkey + 32);
|
||||
|
||||
jobjectArray retArray;
|
||||
jbyteArray privArray, intsByteArray;
|
||||
unsigned char intsarray[2];
|
||||
|
||||
int privkeylen = 32;
|
||||
|
||||
int ret = secp256k1_ec_privkey_tweak_mul(ctx, privkey, tweak);
|
||||
|
||||
intsarray[0] = privkeylen;
|
||||
intsarray[1] = ret;
|
||||
|
||||
retArray = (*env)->NewObjectArray(env, 2,
|
||||
(*env)->FindClass(env, "[B"),
|
||||
(*env)->NewByteArray(env, 1));
|
||||
|
||||
privArray = (*env)->NewByteArray(env, privkeylen);
|
||||
(*env)->SetByteArrayRegion(env, privArray, 0, privkeylen, (jbyte*)privkey);
|
||||
(*env)->SetObjectArrayElement(env, retArray, 0, privArray);
|
||||
|
||||
intsByteArray = (*env)->NewByteArray(env, 2);
|
||||
(*env)->SetByteArrayRegion(env, intsByteArray, 0, 2, (jbyte*)intsarray);
|
||||
(*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray);
|
||||
|
||||
(void)classObject;
|
||||
|
||||
return retArray;
|
||||
}
|
||||
|
||||
SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1pubkey_1tweak_1add
|
||||
(JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l, jint publen)
|
||||
{
|
||||
secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l;
|
||||
/* secp256k1_pubkey* pubkey = (secp256k1_pubkey*) (*env)->GetDirectBufferAddress(env, byteBufferObject);*/
|
||||
unsigned char* pkey = (*env)->GetDirectBufferAddress(env, byteBufferObject);
|
||||
const unsigned char* tweak = (unsigned char*) (pkey + publen);
|
||||
|
||||
jobjectArray retArray;
|
||||
jbyteArray pubArray, intsByteArray;
|
||||
unsigned char intsarray[2];
|
||||
unsigned char outputSer[65];
|
||||
size_t outputLen = 65;
|
||||
|
||||
secp256k1_pubkey pubkey;
|
||||
int ret = secp256k1_ec_pubkey_parse(ctx, &pubkey, pkey, publen);
|
||||
|
||||
if( ret ) {
|
||||
ret = secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, tweak);
|
||||
}
|
||||
|
||||
if( ret ) {
|
||||
int ret2 = secp256k1_ec_pubkey_serialize(ctx,outputSer, &outputLen, &pubkey,SECP256K1_EC_UNCOMPRESSED );(void)ret2;
|
||||
}
|
||||
|
||||
intsarray[0] = outputLen;
|
||||
intsarray[1] = ret;
|
||||
|
||||
retArray = (*env)->NewObjectArray(env, 2,
|
||||
(*env)->FindClass(env, "[B"),
|
||||
(*env)->NewByteArray(env, 1));
|
||||
|
||||
pubArray = (*env)->NewByteArray(env, outputLen);
|
||||
(*env)->SetByteArrayRegion(env, pubArray, 0, outputLen, (jbyte*)outputSer);
|
||||
(*env)->SetObjectArrayElement(env, retArray, 0, pubArray);
|
||||
|
||||
intsByteArray = (*env)->NewByteArray(env, 2);
|
||||
(*env)->SetByteArrayRegion(env, intsByteArray, 0, 2, (jbyte*)intsarray);
|
||||
(*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray);
|
||||
|
||||
(void)classObject;
|
||||
|
||||
return retArray;
|
||||
}
|
||||
|
||||
SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1pubkey_1tweak_1mul
|
||||
(JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l, jint publen)
|
||||
{
|
||||
secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l;
|
||||
unsigned char* pkey = (*env)->GetDirectBufferAddress(env, byteBufferObject);
|
||||
const unsigned char* tweak = (unsigned char*) (pkey + publen);
|
||||
|
||||
jobjectArray retArray;
|
||||
jbyteArray pubArray, intsByteArray;
|
||||
unsigned char intsarray[2];
|
||||
unsigned char outputSer[65];
|
||||
size_t outputLen = 65;
|
||||
|
||||
secp256k1_pubkey pubkey;
|
||||
int ret = secp256k1_ec_pubkey_parse(ctx, &pubkey, pkey, publen);
|
||||
|
||||
if ( ret ) {
|
||||
ret = secp256k1_ec_pubkey_tweak_mul(ctx, &pubkey, tweak);
|
||||
}
|
||||
|
||||
if( ret ) {
|
||||
int ret2 = secp256k1_ec_pubkey_serialize(ctx,outputSer, &outputLen, &pubkey,SECP256K1_EC_UNCOMPRESSED );(void)ret2;
|
||||
}
|
||||
|
||||
intsarray[0] = outputLen;
|
||||
intsarray[1] = ret;
|
||||
|
||||
retArray = (*env)->NewObjectArray(env, 2,
|
||||
(*env)->FindClass(env, "[B"),
|
||||
(*env)->NewByteArray(env, 1));
|
||||
|
||||
pubArray = (*env)->NewByteArray(env, outputLen);
|
||||
(*env)->SetByteArrayRegion(env, pubArray, 0, outputLen, (jbyte*)outputSer);
|
||||
(*env)->SetObjectArrayElement(env, retArray, 0, pubArray);
|
||||
|
||||
intsByteArray = (*env)->NewByteArray(env, 2);
|
||||
(*env)->SetByteArrayRegion(env, intsByteArray, 0, 2, (jbyte*)intsarray);
|
||||
(*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray);
|
||||
|
||||
(void)classObject;
|
||||
|
||||
return retArray;
|
||||
}
|
||||
|
||||
SECP256K1_API jlong JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdsa_1pubkey_1combine
|
||||
(JNIEnv * env, jclass classObject, jobject byteBufferObject, jlong ctx_l, jint numkeys)
|
||||
{
|
||||
(void)classObject;(void)env;(void)byteBufferObject;(void)ctx_l;(void)numkeys;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdh
|
||||
(JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l, jint publen)
|
||||
{
|
||||
secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l;
|
||||
const unsigned char* secdata = (*env)->GetDirectBufferAddress(env, byteBufferObject);
|
||||
const unsigned char* pubdata = (const unsigned char*) (secdata + 32);
|
||||
|
||||
jobjectArray retArray;
|
||||
jbyteArray outArray, intsByteArray;
|
||||
unsigned char intsarray[1];
|
||||
secp256k1_pubkey pubkey;
|
||||
unsigned char nonce_res[32];
|
||||
size_t outputLen = 32;
|
||||
|
||||
int ret = secp256k1_ec_pubkey_parse(ctx, &pubkey, pubdata, publen);
|
||||
|
||||
if (ret) {
|
||||
ret = secp256k1_ecdh(
|
||||
ctx,
|
||||
nonce_res,
|
||||
&pubkey,
|
||||
secdata
|
||||
);
|
||||
}
|
||||
|
||||
intsarray[0] = ret;
|
||||
|
||||
retArray = (*env)->NewObjectArray(env, 2,
|
||||
(*env)->FindClass(env, "[B"),
|
||||
(*env)->NewByteArray(env, 1));
|
||||
|
||||
outArray = (*env)->NewByteArray(env, outputLen);
|
||||
(*env)->SetByteArrayRegion(env, outArray, 0, 32, (jbyte*)nonce_res);
|
||||
(*env)->SetObjectArrayElement(env, retArray, 0, outArray);
|
||||
|
||||
intsByteArray = (*env)->NewByteArray(env, 1);
|
||||
(*env)->SetByteArrayRegion(env, intsByteArray, 0, 1, (jbyte*)intsarray);
|
||||
(*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray);
|
||||
|
||||
(void)classObject;
|
||||
|
||||
return retArray;
|
||||
}
|
|
@ -1,119 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
#include "include/secp256k1.h"
|
||||
/* Header for class org_bitcoin_NativeSecp256k1 */
|
||||
|
||||
#ifndef _Included_org_bitcoin_NativeSecp256k1
|
||||
#define _Included_org_bitcoin_NativeSecp256k1
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: org_bitcoin_NativeSecp256k1
|
||||
* Method: secp256k1_ctx_clone
|
||||
* Signature: (J)J
|
||||
*/
|
||||
SECP256K1_API jlong JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ctx_1clone
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_bitcoin_NativeSecp256k1
|
||||
* Method: secp256k1_context_randomize
|
||||
* Signature: (Ljava/nio/ByteBuffer;J)I
|
||||
*/
|
||||
SECP256K1_API jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1context_1randomize
|
||||
(JNIEnv *, jclass, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_bitcoin_NativeSecp256k1
|
||||
* Method: secp256k1_privkey_tweak_add
|
||||
* Signature: (Ljava/nio/ByteBuffer;J)[[B
|
||||
*/
|
||||
SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1privkey_1tweak_1add
|
||||
(JNIEnv *, jclass, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_bitcoin_NativeSecp256k1
|
||||
* Method: secp256k1_privkey_tweak_mul
|
||||
* Signature: (Ljava/nio/ByteBuffer;J)[[B
|
||||
*/
|
||||
SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1privkey_1tweak_1mul
|
||||
(JNIEnv *, jclass, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_bitcoin_NativeSecp256k1
|
||||
* Method: secp256k1_pubkey_tweak_add
|
||||
* Signature: (Ljava/nio/ByteBuffer;JI)[[B
|
||||
*/
|
||||
SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1pubkey_1tweak_1add
|
||||
(JNIEnv *, jclass, jobject, jlong, jint);
|
||||
|
||||
/*
|
||||
* Class: org_bitcoin_NativeSecp256k1
|
||||
* Method: secp256k1_pubkey_tweak_mul
|
||||
* Signature: (Ljava/nio/ByteBuffer;JI)[[B
|
||||
*/
|
||||
SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1pubkey_1tweak_1mul
|
||||
(JNIEnv *, jclass, jobject, jlong, jint);
|
||||
|
||||
/*
|
||||
* Class: org_bitcoin_NativeSecp256k1
|
||||
* Method: secp256k1_destroy_context
|
||||
* Signature: (J)V
|
||||
*/
|
||||
SECP256K1_API void JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1destroy_1context
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_bitcoin_NativeSecp256k1
|
||||
* Method: secp256k1_ecdsa_verify
|
||||
* Signature: (Ljava/nio/ByteBuffer;JII)I
|
||||
*/
|
||||
SECP256K1_API jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdsa_1verify
|
||||
(JNIEnv *, jclass, jobject, jlong, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: org_bitcoin_NativeSecp256k1
|
||||
* Method: secp256k1_ecdsa_sign
|
||||
* Signature: (Ljava/nio/ByteBuffer;J)[[B
|
||||
*/
|
||||
SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdsa_1sign
|
||||
(JNIEnv *, jclass, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_bitcoin_NativeSecp256k1
|
||||
* Method: secp256k1_ec_seckey_verify
|
||||
* Signature: (Ljava/nio/ByteBuffer;J)I
|
||||
*/
|
||||
SECP256K1_API jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ec_1seckey_1verify
|
||||
(JNIEnv *, jclass, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_bitcoin_NativeSecp256k1
|
||||
* Method: secp256k1_ec_pubkey_create
|
||||
* Signature: (Ljava/nio/ByteBuffer;J)[[B
|
||||
*/
|
||||
SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ec_1pubkey_1create
|
||||
(JNIEnv *, jclass, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_bitcoin_NativeSecp256k1
|
||||
* Method: secp256k1_ec_pubkey_parse
|
||||
* Signature: (Ljava/nio/ByteBuffer;JI)[[B
|
||||
*/
|
||||
SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ec_1pubkey_1parse
|
||||
(JNIEnv *, jclass, jobject, jlong, jint);
|
||||
|
||||
/*
|
||||
* Class: org_bitcoin_NativeSecp256k1
|
||||
* Method: secp256k1_ecdh
|
||||
* Signature: (Ljava/nio/ByteBuffer;JI)[[B
|
||||
*/
|
||||
SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdh
|
||||
(JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l, jint publen);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -1,15 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "org_bitcoin_Secp256k1Context.h"
|
||||
#include "include/secp256k1.h"
|
||||
|
||||
SECP256K1_API jlong JNICALL Java_org_bitcoin_Secp256k1Context_secp256k1_1init_1context
|
||||
(JNIEnv* env, jclass classObject)
|
||||
{
|
||||
secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY);
|
||||
|
||||
(void)classObject;(void)env;
|
||||
|
||||
return (uintptr_t)ctx;
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
#include "include/secp256k1.h"
|
||||
/* Header for class org_bitcoin_Secp256k1Context */
|
||||
|
||||
#ifndef _Included_org_bitcoin_Secp256k1Context
|
||||
#define _Included_org_bitcoin_Secp256k1Context
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: org_bitcoin_Secp256k1Context
|
||||
* Method: secp256k1_init_context
|
||||
* Signature: ()J
|
||||
*/
|
||||
SECP256K1_API jlong JNICALL Java_org_bitcoin_Secp256k1Context_secp256k1_1init_1context
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -1,54 +0,0 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2015 Andrew Poelstra *
|
||||
* Distributed under the MIT software license, see the accompanying *
|
||||
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef _SECP256K1_MODULE_ECDH_MAIN_
|
||||
#define _SECP256K1_MODULE_ECDH_MAIN_
|
||||
|
||||
#include "include/secp256k1_ecdh.h"
|
||||
#include "ecmult_const_impl.h"
|
||||
|
||||
int secp256k1_ecdh(const secp256k1_context* ctx, unsigned char *result, const secp256k1_pubkey *point, const unsigned char *scalar) {
|
||||
int ret = 0;
|
||||
int overflow = 0;
|
||||
secp256k1_gej res;
|
||||
secp256k1_ge pt;
|
||||
secp256k1_scalar s;
|
||||
VERIFY_CHECK(ctx != NULL);
|
||||
ARG_CHECK(result != NULL);
|
||||
ARG_CHECK(point != NULL);
|
||||
ARG_CHECK(scalar != NULL);
|
||||
|
||||
secp256k1_pubkey_load(ctx, &pt, point);
|
||||
secp256k1_scalar_set_b32(&s, scalar, &overflow);
|
||||
if (overflow || secp256k1_scalar_is_zero(&s)) {
|
||||
ret = 0;
|
||||
} else {
|
||||
unsigned char x[32];
|
||||
unsigned char y[1];
|
||||
secp256k1_sha256_t sha;
|
||||
|
||||
secp256k1_ecmult_const(&res, &pt, &s);
|
||||
secp256k1_ge_set_gej(&pt, &res);
|
||||
/* Compute a hash of the point in compressed form
|
||||
* Note we cannot use secp256k1_eckey_pubkey_serialize here since it does not
|
||||
* expect its output to be secret and has a timing sidechannel. */
|
||||
secp256k1_fe_normalize(&pt.x);
|
||||
secp256k1_fe_normalize(&pt.y);
|
||||
secp256k1_fe_get_b32(x, &pt.x);
|
||||
y[0] = 0x02 | secp256k1_fe_is_odd(&pt.y);
|
||||
|
||||
secp256k1_sha256_initialize(&sha);
|
||||
secp256k1_sha256_write(&sha, y, sizeof(y));
|
||||
secp256k1_sha256_write(&sha, x, sizeof(x));
|
||||
secp256k1_sha256_finalize(&sha, result);
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
secp256k1_scalar_clear(&s);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,105 +0,0 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2015 Andrew Poelstra *
|
||||
* Distributed under the MIT software license, see the accompanying *
|
||||
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef _SECP256K1_MODULE_ECDH_TESTS_
|
||||
#define _SECP256K1_MODULE_ECDH_TESTS_
|
||||
|
||||
void test_ecdh_api(void) {
|
||||
/* Setup context that just counts errors */
|
||||
secp256k1_context *tctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN);
|
||||
secp256k1_pubkey point;
|
||||
unsigned char res[32];
|
||||
unsigned char s_one[32] = { 0 };
|
||||
int32_t ecount = 0;
|
||||
s_one[31] = 1;
|
||||
|
||||
secp256k1_context_set_error_callback(tctx, counting_illegal_callback_fn, &ecount);
|
||||
secp256k1_context_set_illegal_callback(tctx, counting_illegal_callback_fn, &ecount);
|
||||
CHECK(secp256k1_ec_pubkey_create(tctx, &point, s_one) == 1);
|
||||
|
||||
/* Check all NULLs are detected */
|
||||
CHECK(secp256k1_ecdh(tctx, res, &point, s_one) == 1);
|
||||
CHECK(ecount == 0);
|
||||
CHECK(secp256k1_ecdh(tctx, NULL, &point, s_one) == 0);
|
||||
CHECK(ecount == 1);
|
||||
CHECK(secp256k1_ecdh(tctx, res, NULL, s_one) == 0);
|
||||
CHECK(ecount == 2);
|
||||
CHECK(secp256k1_ecdh(tctx, res, &point, NULL) == 0);
|
||||
CHECK(ecount == 3);
|
||||
CHECK(secp256k1_ecdh(tctx, res, &point, s_one) == 1);
|
||||
CHECK(ecount == 3);
|
||||
|
||||
/* Cleanup */
|
||||
secp256k1_context_destroy(tctx);
|
||||
}
|
||||
|
||||
void test_ecdh_generator_basepoint(void) {
|
||||
unsigned char s_one[32] = { 0 };
|
||||
secp256k1_pubkey point[2];
|
||||
int i;
|
||||
|
||||
s_one[31] = 1;
|
||||
/* Check against pubkey creation when the basepoint is the generator */
|
||||
for (i = 0; i < 100; ++i) {
|
||||
secp256k1_sha256_t sha;
|
||||
unsigned char s_b32[32];
|
||||
unsigned char output_ecdh[32];
|
||||
unsigned char output_ser[32];
|
||||
unsigned char point_ser[33];
|
||||
size_t point_ser_len = sizeof(point_ser);
|
||||
secp256k1_scalar s;
|
||||
|
||||
random_scalar_order(&s);
|
||||
secp256k1_scalar_get_b32(s_b32, &s);
|
||||
|
||||
/* compute using ECDH function */
|
||||
CHECK(secp256k1_ec_pubkey_create(ctx, &point[0], s_one) == 1);
|
||||
CHECK(secp256k1_ecdh(ctx, output_ecdh, &point[0], s_b32) == 1);
|
||||
/* compute "explicitly" */
|
||||
CHECK(secp256k1_ec_pubkey_create(ctx, &point[1], s_b32) == 1);
|
||||
CHECK(secp256k1_ec_pubkey_serialize(ctx, point_ser, &point_ser_len, &point[1], SECP256K1_EC_COMPRESSED) == 1);
|
||||
CHECK(point_ser_len == sizeof(point_ser));
|
||||
secp256k1_sha256_initialize(&sha);
|
||||
secp256k1_sha256_write(&sha, point_ser, point_ser_len);
|
||||
secp256k1_sha256_finalize(&sha, output_ser);
|
||||
/* compare */
|
||||
CHECK(memcmp(output_ecdh, output_ser, sizeof(output_ser)) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
void test_bad_scalar(void) {
|
||||
unsigned char s_zero[32] = { 0 };
|
||||
unsigned char s_overflow[32] = {
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe,
|
||||
0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b,
|
||||
0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x41
|
||||
};
|
||||
unsigned char s_rand[32] = { 0 };
|
||||
unsigned char output[32];
|
||||
secp256k1_scalar rand;
|
||||
secp256k1_pubkey point;
|
||||
|
||||
/* Create random point */
|
||||
random_scalar_order(&rand);
|
||||
secp256k1_scalar_get_b32(s_rand, &rand);
|
||||
CHECK(secp256k1_ec_pubkey_create(ctx, &point, s_rand) == 1);
|
||||
|
||||
/* Try to multiply it by bad values */
|
||||
CHECK(secp256k1_ecdh(ctx, output, &point, s_zero) == 0);
|
||||
CHECK(secp256k1_ecdh(ctx, output, &point, s_overflow) == 0);
|
||||
/* ...and a good one */
|
||||
s_overflow[31] -= 1;
|
||||
CHECK(secp256k1_ecdh(ctx, output, &point, s_overflow) == 1);
|
||||
}
|
||||
|
||||
void run_ecdh_tests(void) {
|
||||
test_ecdh_api();
|
||||
test_ecdh_generator_basepoint();
|
||||
test_bad_scalar();
|
||||
}
|
||||
|
||||
#endif
|
35
vendor/github.com/mutecomm/go-sqlcipher/v4/_example/mod_regexp/sqlite3_mod_regexp.c
generated
vendored
35
vendor/github.com/mutecomm/go-sqlcipher/v4/_example/mod_regexp/sqlite3_mod_regexp.c
generated
vendored
|
@ -1,35 +0,0 @@
|
|||
#include <pcre.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <sqlite3ext.h>
|
||||
|
||||
SQLITE_EXTENSION_INIT1
|
||||
static void regexp_func(sqlite3_context *context, int argc, sqlite3_value **argv) {
|
||||
if (argc >= 2) {
|
||||
const char *target = (const char *)sqlite3_value_text(argv[1]);
|
||||
const char *pattern = (const char *)sqlite3_value_text(argv[0]);
|
||||
const char* errstr = NULL;
|
||||
int erroff = 0;
|
||||
int vec[500];
|
||||
int n, rc;
|
||||
pcre* re = pcre_compile(pattern, 0, &errstr, &erroff, NULL);
|
||||
if (!re) {
|
||||
sqlite3_result_error(context, errstr, 0);
|
||||
return;
|
||||
}
|
||||
rc = pcre_exec(re, NULL, target, strlen(target), 0, 0, vec, 500);
|
||||
if (rc <= 0) {
|
||||
sqlite3_result_int(context, 0);
|
||||
return;
|
||||
}
|
||||
sqlite3_result_int(context, 1);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
int sqlite3_extension_init(sqlite3 *db, char **errmsg, const sqlite3_api_routines *api) {
|
||||
SQLITE_EXTENSION_INIT2(api);
|
||||
return sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8, (void*)db, regexp_func, NULL, NULL);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,122 +0,0 @@
|
|||
// +build ingore
|
||||
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright 2013 Garrett D'Amore <garrett@damore.org>
|
||||
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2004 Tim J. Robbins.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2011 The FreeBSD Foundation
|
||||
* All rights reserved.
|
||||
* Portions of this software were developed by David Chisnall
|
||||
* under sponsorship from the FreeBSD Foundation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _MBLOCAL_H_
|
||||
#define _MBLOCAL_H_
|
||||
|
||||
#include <runetype.h>
|
||||
#include "xlocale_private.h"
|
||||
|
||||
#define SS2 0x008e
|
||||
#define SS3 0x008f
|
||||
|
||||
/*
|
||||
* Conversion function pointers for current encoding.
|
||||
*/
|
||||
struct xlocale_ctype {
|
||||
struct xlocale_component header;
|
||||
_RuneLocale *runes;
|
||||
size_t (*__mbrtowc)(wchar_t * __restrict, const char * __restrict,
|
||||
size_t, mbstate_t * __restrict);
|
||||
int (*__mbsinit)(const mbstate_t *);
|
||||
size_t (*__mbsnrtowcs)(wchar_t * __restrict, const char ** __restrict,
|
||||
size_t, size_t, mbstate_t * __restrict);
|
||||
size_t (*__wcrtomb)(char * __restrict, wchar_t, mbstate_t * __restrict);
|
||||
size_t (*__wcsnrtombs)(char * __restrict, const wchar_t ** __restrict,
|
||||
size_t, size_t, mbstate_t * __restrict);
|
||||
int __mb_cur_max;
|
||||
int __mb_sb_limit;
|
||||
/** Persistent state used by mblen() calls. */
|
||||
__mbstate_t mblen;
|
||||
/** Persistent state used by mbrlen() calls. */
|
||||
__mbstate_t mbrlen;
|
||||
/** Persistent state used by mbrtoc16() calls. */
|
||||
__mbstate_t mbrtoc16;
|
||||
/** Persistent state used by mbrtoc32() calls. */
|
||||
__mbstate_t mbrtoc32;
|
||||
/** Persistent state used by mbrtowc() calls. */
|
||||
__mbstate_t mbrtowc;
|
||||
/** Persistent state used by mbsnrtowcs() calls. */
|
||||
__mbstate_t mbsnrtowcs;
|
||||
/** Persistent state used by mbsrtowcs() calls. */
|
||||
__mbstate_t mbsrtowcs;
|
||||
/** Persistent state used by mbtowc() calls. */
|
||||
__mbstate_t mbtowc;
|
||||
/** Persistent state used by c16rtomb() calls. */
|
||||
__mbstate_t c16rtomb;
|
||||
/** Persistent state used by c32rtomb() calls. */
|
||||
__mbstate_t c32rtomb;
|
||||
/** Persistent state used by wcrtomb() calls. */
|
||||
__mbstate_t wcrtomb;
|
||||
/** Persistent state used by wcsnrtombs() calls. */
|
||||
__mbstate_t wcsnrtombs;
|
||||
/** Persistent state used by wcsrtombs() calls. */
|
||||
__mbstate_t wcsrtombs;
|
||||
/** Persistent state used by wctomb() calls. */
|
||||
__mbstate_t wctomb;
|
||||
};
|
||||
#define XLOCALE_CTYPE(x) ((struct xlocale_ctype*)(x)->components[XLC_CTYPE])
|
||||
extern struct xlocale_ctype __xlocale_global_ctype;
|
||||
|
||||
/*
|
||||
* Rune initialization function prototypes.
|
||||
*/
|
||||
int _none_init(struct xlocale_ctype *, _RuneLocale *) __hidden;
|
||||
int _UTF8_init(struct xlocale_ctype *, _RuneLocale *) __hidden;
|
||||
int _EUC_CN_init(struct xlocale_ctype *, _RuneLocale *) __hidden;
|
||||
int _EUC_JP_init(struct xlocale_ctype *, _RuneLocale *) __hidden;
|
||||
int _EUC_KR_init(struct xlocale_ctype *, _RuneLocale *) __hidden;
|
||||
int _EUC_TW_init(struct xlocale_ctype *, _RuneLocale *) __hidden;
|
||||
int _GB18030_init(struct xlocale_ctype *, _RuneLocale *) __hidden;
|
||||
int _GB2312_init(struct xlocale_ctype *, _RuneLocale *) __hidden;
|
||||
int _GBK_init(struct xlocale_ctype *, _RuneLocale *) __hidden;
|
||||
int _BIG5_init(struct xlocale_ctype *, _RuneLocale *) __hidden;
|
||||
int _MSKanji_init(struct xlocale_ctype *, _RuneLocale *) __hidden;
|
||||
int _ascii_init(struct xlocale_ctype *, _RuneLocale *) __hidden;
|
||||
|
||||
typedef size_t (*mbrtowc_pfn_t)(wchar_t * __restrict,
|
||||
const char * __restrict, size_t, mbstate_t * __restrict);
|
||||
typedef size_t (*wcrtomb_pfn_t)(char * __restrict, wchar_t,
|
||||
mbstate_t * __restrict);
|
||||
size_t __mbsnrtowcs_std(wchar_t * __restrict, const char ** __restrict,
|
||||
size_t, size_t, mbstate_t * __restrict, mbrtowc_pfn_t);
|
||||
size_t __wcsnrtombs_std(char * __restrict, const wchar_t ** __restrict,
|
||||
size_t, size_t, mbstate_t * __restrict, wcrtomb_pfn_t);
|
||||
|
||||
#endif /* _MBLOCAL_H_ */
|
|
@ -1,13 +0,0 @@
|
|||
|
||||
#ifndef _SETLOCALE_H_
|
||||
#define _SETLOCALE_H_
|
||||
|
||||
#define ENCODING_LEN 31
|
||||
#define CATEGORY_LEN 11
|
||||
|
||||
extern char *_PathLocale;
|
||||
|
||||
int __detect_path_locale(void);
|
||||
int __wrap_setrunelocale(const char *);
|
||||
|
||||
#endif /* !_SETLOCALE_H_ */
|
|
@ -1,267 +0,0 @@
|
|||
// +build ingore
|
||||
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* Copyright (c) 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Paul Borman at Krystal Technologies.
|
||||
*
|
||||
* Copyright (c) 2011 The FreeBSD Foundation
|
||||
* All rights reserved.
|
||||
* Portions of this software were developed by David Chisnall
|
||||
* under sponsorship from the FreeBSD Foundation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)table.c 8.1 (Berkeley) 6/27/93";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <ctype.h>
|
||||
#include <runetype.h>
|
||||
#include <wchar.h>
|
||||
#include "mblocal.h"
|
||||
|
||||
const _RuneLocale _DefaultRuneLocale = {
|
||||
_RUNE_MAGIC_1,
|
||||
"NONE",
|
||||
NULL,
|
||||
NULL,
|
||||
0xFFFD,
|
||||
|
||||
{ /*00*/ _CTYPE_C,
|
||||
_CTYPE_C,
|
||||
_CTYPE_C,
|
||||
_CTYPE_C,
|
||||
_CTYPE_C,
|
||||
_CTYPE_C,
|
||||
_CTYPE_C,
|
||||
_CTYPE_C,
|
||||
/*08*/ _CTYPE_C,
|
||||
_CTYPE_C|_CTYPE_S|_CTYPE_B,
|
||||
_CTYPE_C|_CTYPE_S,
|
||||
_CTYPE_C|_CTYPE_S,
|
||||
_CTYPE_C|_CTYPE_S,
|
||||
_CTYPE_C|_CTYPE_S,
|
||||
_CTYPE_C,
|
||||
_CTYPE_C,
|
||||
/*10*/ _CTYPE_C,
|
||||
_CTYPE_C,
|
||||
_CTYPE_C,
|
||||
_CTYPE_C,
|
||||
_CTYPE_C,
|
||||
_CTYPE_C,
|
||||
_CTYPE_C,
|
||||
_CTYPE_C,
|
||||
/*18*/ _CTYPE_C,
|
||||
_CTYPE_C,
|
||||
_CTYPE_C,
|
||||
_CTYPE_C,
|
||||
_CTYPE_C,
|
||||
_CTYPE_C,
|
||||
_CTYPE_C,
|
||||
_CTYPE_C,
|
||||
/*20*/ _CTYPE_S|_CTYPE_B|_CTYPE_R,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
/*28*/ _CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
/*30*/ _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|_CTYPE_N|0,
|
||||
_CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|_CTYPE_N|1,
|
||||
_CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|_CTYPE_N|2,
|
||||
_CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|_CTYPE_N|3,
|
||||
_CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|_CTYPE_N|4,
|
||||
_CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|_CTYPE_N|5,
|
||||
_CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|_CTYPE_N|6,
|
||||
_CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|_CTYPE_N|7,
|
||||
/*38*/ _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|_CTYPE_N|8,
|
||||
_CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|_CTYPE_N|9,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
/*40*/ _CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|10,
|
||||
_CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|11,
|
||||
_CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|12,
|
||||
_CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|13,
|
||||
_CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|14,
|
||||
_CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|15,
|
||||
_CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
/*48*/ _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
/*50*/ _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
/*58*/ _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
/*60*/ _CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|10,
|
||||
_CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|11,
|
||||
_CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|12,
|
||||
_CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|13,
|
||||
_CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|14,
|
||||
_CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|15,
|
||||
_CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
/*68*/ _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
/*70*/ _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
/*78*/ _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_P|_CTYPE_R|_CTYPE_G,
|
||||
_CTYPE_C,
|
||||
},
|
||||
{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
|
||||
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
|
||||
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
||||
0x40, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
|
||||
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
||||
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
|
||||
'x', 'y', 'z', 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
|
||||
0x60, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
|
||||
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
||||
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
|
||||
'x', 'y', 'z', 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
|
||||
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
||||
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
|
||||
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
|
||||
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
|
||||
0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
|
||||
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
||||
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
||||
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
|
||||
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
|
||||
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
|
||||
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
||||
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
|
||||
},
|
||||
{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
|
||||
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
|
||||
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
||||
0x40, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
|
||||
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
|
||||
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
|
||||
'X', 'Y', 'Z', 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
|
||||
0x60, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
|
||||
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
|
||||
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
|
||||
'X', 'Y', 'Z', 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
|
||||
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
||||
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
|
||||
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
|
||||
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
|
||||
0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
|
||||
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
||||
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
||||
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
|
||||
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
|
||||
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
|
||||
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
||||
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
|
||||
},
|
||||
};
|
||||
|
||||
#undef _CurrentRuneLocale
|
||||
const _RuneLocale *_CurrentRuneLocale = &_DefaultRuneLocale;
|
||||
|
||||
_RuneLocale *
|
||||
__runes_for_locale(locale_t locale, int *mb_sb_limit)
|
||||
{
|
||||
FIX_LOCALE(locale);
|
||||
struct xlocale_ctype *c = XLOCALE_CTYPE(locale);
|
||||
*mb_sb_limit = c->__mb_sb_limit;
|
||||
return c->runes;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,228 +0,0 @@
|
|||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2011 The FreeBSD Foundation
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software was developed by David Chisnall under sponsorship from
|
||||
* the FreeBSD Foundation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _XLOCALE_PRIVATE__H_
|
||||
#define _XLOCALE_PRIVATE__H_
|
||||
|
||||
#include <xlocale.h>
|
||||
#include <locale.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <machine/atomic.h>
|
||||
#include "setlocale.h"
|
||||
|
||||
/**
|
||||
* The XLC_ values are indexes into the components array. They are defined in
|
||||
* the same order as the LC_ values in locale.h, but without the LC_ALL zero
|
||||
* value. Translating from LC_X to XLC_X is done by subtracting one.
|
||||
*
|
||||
* Any reordering of this enum should ensure that these invariants are not
|
||||
* violated.
|
||||
*/
|
||||
enum {
|
||||
XLC_COLLATE = 0,
|
||||
XLC_CTYPE,
|
||||
XLC_MONETARY,
|
||||
XLC_NUMERIC,
|
||||
XLC_TIME,
|
||||
XLC_MESSAGES,
|
||||
XLC_LAST
|
||||
};
|
||||
|
||||
_Static_assert(XLC_LAST - XLC_COLLATE == 6, "XLC values should be contiguous");
|
||||
_Static_assert(XLC_COLLATE == LC_COLLATE - 1,
|
||||
"XLC_COLLATE doesn't match the LC_COLLATE value.");
|
||||
_Static_assert(XLC_CTYPE == LC_CTYPE - 1,
|
||||
"XLC_CTYPE doesn't match the LC_CTYPE value.");
|
||||
_Static_assert(XLC_MONETARY == LC_MONETARY - 1,
|
||||
"XLC_MONETARY doesn't match the LC_MONETARY value.");
|
||||
_Static_assert(XLC_NUMERIC == LC_NUMERIC - 1,
|
||||
"XLC_NUMERIC doesn't match the LC_NUMERIC value.");
|
||||
_Static_assert(XLC_TIME == LC_TIME - 1,
|
||||
"XLC_TIME doesn't match the LC_TIME value.");
|
||||
_Static_assert(XLC_MESSAGES == LC_MESSAGES - 1,
|
||||
"XLC_MESSAGES doesn't match the LC_MESSAGES value.");
|
||||
|
||||
/**
|
||||
* Header used for objects that are reference counted. Objects may optionally
|
||||
* have a destructor associated, which is responsible for destroying the
|
||||
* structure. Global / static versions of the structure should have no
|
||||
* destructor set - they can then have their reference counts manipulated as
|
||||
* normal, but will not do anything with them.
|
||||
*
|
||||
* The header stores a retain count - objects are assumed to have a reference
|
||||
* count of 1 when they are created, but the retain count is 0. When the
|
||||
* retain count is less than 0, they are freed.
|
||||
*/
|
||||
struct xlocale_refcounted {
|
||||
/** Number of references to this component. */
|
||||
long retain_count;
|
||||
/** Function used to destroy this component, if one is required*/
|
||||
void(*destructor)(void*);
|
||||
};
|
||||
|
||||
#define XLOCALE_DEF_VERSION_LEN 12
|
||||
|
||||
/**
|
||||
* Header for a locale component. All locale components must begin with this
|
||||
* header.
|
||||
*/
|
||||
struct xlocale_component {
|
||||
struct xlocale_refcounted header;
|
||||
/** Name of the locale used for this component. */
|
||||
char locale[ENCODING_LEN+1];
|
||||
/** Version of the definition for this component. */
|
||||
char version[XLOCALE_DEF_VERSION_LEN];
|
||||
};
|
||||
|
||||
/**
|
||||
* xlocale structure, stores per-thread locale information.
|
||||
*/
|
||||
struct _xlocale {
|
||||
struct xlocale_refcounted header;
|
||||
/** Components for the locale. */
|
||||
struct xlocale_component *components[XLC_LAST];
|
||||
/** Flag indicating if components[XLC_MONETARY] has changed since the
|
||||
* last call to localeconv_l() with this locale. */
|
||||
int monetary_locale_changed;
|
||||
/** Flag indicating whether this locale is actually using a locale for
|
||||
* LC_MONETARY (1), or if it should use the C default instead (0). */
|
||||
int using_monetary_locale;
|
||||
/** Flag indicating if components[XLC_NUMERIC] has changed since the
|
||||
* last call to localeconv_l() with this locale. */
|
||||
int numeric_locale_changed;
|
||||
/** Flag indicating whether this locale is actually using a locale for
|
||||
* LC_NUMERIC (1), or if it should use the C default instead (0). */
|
||||
int using_numeric_locale;
|
||||
/** Flag indicating whether this locale is actually using a locale for
|
||||
* LC_TIME (1), or if it should use the C default instead (0). */
|
||||
int using_time_locale;
|
||||
/** Flag indicating whether this locale is actually using a locale for
|
||||
* LC_MESSAGES (1), or if it should use the C default instead (0). */
|
||||
int using_messages_locale;
|
||||
/** The structure to be returned from localeconv_l() for this locale. */
|
||||
struct lconv lconv;
|
||||
/** Buffer used by nl_langinfo_l() */
|
||||
char *csym;
|
||||
};
|
||||
|
||||
/**
|
||||
* Increments the reference count of a reference-counted structure.
|
||||
*/
|
||||
__attribute__((unused)) static void*
|
||||
xlocale_retain(void *val)
|
||||
{
|
||||
struct xlocale_refcounted *obj = val;
|
||||
atomic_add_long(&(obj->retain_count), 1);
|
||||
return (val);
|
||||
}
|
||||
/**
|
||||
* Decrements the reference count of a reference-counted structure, freeing it
|
||||
* if this is the last reference, calling its destructor if it has one.
|
||||
*/
|
||||
__attribute__((unused)) static void
|
||||
xlocale_release(void *val)
|
||||
{
|
||||
struct xlocale_refcounted *obj = val;
|
||||
long count;
|
||||
|
||||
count = atomic_fetchadd_long(&(obj->retain_count), -1) - 1;
|
||||
if (count < 0 && obj->destructor != NULL)
|
||||
obj->destructor(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load functions. Each takes the name of a locale and a pointer to the data
|
||||
* to be initialised as arguments. Two special values are allowed for the
|
||||
*/
|
||||
extern void* __collate_load(const char*, locale_t);
|
||||
extern void* __ctype_load(const char*, locale_t);
|
||||
extern void* __messages_load(const char*, locale_t);
|
||||
extern void* __monetary_load(const char*, locale_t);
|
||||
extern void* __numeric_load(const char*, locale_t);
|
||||
extern void* __time_load(const char*, locale_t);
|
||||
|
||||
extern struct _xlocale __xlocale_global_locale;
|
||||
extern struct _xlocale __xlocale_C_locale;
|
||||
|
||||
/**
|
||||
* Caches the rune table in TLS for fast access.
|
||||
*/
|
||||
void __set_thread_rune_locale(locale_t loc);
|
||||
/**
|
||||
* Flag indicating whether a per-thread locale has been set. If no per-thread
|
||||
* locale has ever been set, then we always use the global locale.
|
||||
*/
|
||||
extern int __has_thread_locale;
|
||||
|
||||
/**
|
||||
* The per-thread locale. Avoids the need to use pthread lookup functions when
|
||||
* getting the per-thread locale.
|
||||
*/
|
||||
extern _Thread_local locale_t __thread_locale;
|
||||
|
||||
/**
|
||||
* Returns the current locale for this thread, or the global locale if none is
|
||||
* set. The caller does not have to free the locale. The return value from
|
||||
* this call is not guaranteed to remain valid after the locale changes. As
|
||||
* such, this should only be called within libc functions.
|
||||
*/
|
||||
static inline locale_t __get_locale(void)
|
||||
{
|
||||
|
||||
if (!__has_thread_locale) {
|
||||
return (&__xlocale_global_locale);
|
||||
}
|
||||
return (__thread_locale ? __thread_locale : &__xlocale_global_locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Two magic values are allowed for locale_t objects. NULL and -1. This
|
||||
* function maps those to the real locales that they represent.
|
||||
*/
|
||||
static inline locale_t get_real_locale(locale_t locale)
|
||||
{
|
||||
switch ((intptr_t)locale) {
|
||||
case 0: return (&__xlocale_C_locale);
|
||||
case -1: return (&__xlocale_global_locale);
|
||||
default: return (locale);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace a placeholder locale with the real global or thread-local locale_t.
|
||||
*/
|
||||
#define FIX_LOCALE(l) (l = get_real_locale(l))
|
||||
|
||||
#endif
|
|
@ -1,82 +0,0 @@
|
|||
#define a_ll a_ll
|
||||
static inline int a_ll(volatile int *p)
|
||||
{
|
||||
int v;
|
||||
__asm__ __volatile__ ("ldaxr %w0,%1" : "=r"(v) : "Q"(*p));
|
||||
return v;
|
||||
}
|
||||
|
||||
#define a_sc a_sc
|
||||
static inline int a_sc(volatile int *p, int v)
|
||||
{
|
||||
int r;
|
||||
__asm__ __volatile__ ("stlxr %w0,%w2,%1" : "=&r"(r), "=Q"(*p) : "r"(v) : "memory");
|
||||
return !r;
|
||||
}
|
||||
|
||||
#define a_barrier a_barrier
|
||||
static inline void a_barrier()
|
||||
{
|
||||
__asm__ __volatile__ ("dmb ish" : : : "memory");
|
||||
}
|
||||
|
||||
#define a_cas a_cas
|
||||
static inline int a_cas(volatile int *p, int t, int s)
|
||||
{
|
||||
int old;
|
||||
do {
|
||||
old = a_ll(p);
|
||||
if (old != t) {
|
||||
a_barrier();
|
||||
break;
|
||||
}
|
||||
} while (!a_sc(p, s));
|
||||
return old;
|
||||
}
|
||||
|
||||
#define a_ll_p a_ll_p
|
||||
static inline void *a_ll_p(volatile void *p)
|
||||
{
|
||||
void *v;
|
||||
__asm__ __volatile__ ("ldaxr %0, %1" : "=r"(v) : "Q"(*(void *volatile *)p));
|
||||
return v;
|
||||
}
|
||||
|
||||
#define a_sc_p a_sc_p
|
||||
static inline int a_sc_p(volatile int *p, void *v)
|
||||
{
|
||||
int r;
|
||||
__asm__ __volatile__ ("stlxr %w0,%2,%1" : "=&r"(r), "=Q"(*(void *volatile *)p) : "r"(v) : "memory");
|
||||
return !r;
|
||||
}
|
||||
|
||||
#define a_cas_p a_cas_p
|
||||
static inline void *a_cas_p(volatile void *p, void *t, void *s)
|
||||
{
|
||||
void *old;
|
||||
do {
|
||||
old = a_ll_p(p);
|
||||
if (old != t) {
|
||||
a_barrier();
|
||||
break;
|
||||
}
|
||||
} while (!a_sc_p(p, s));
|
||||
return old;
|
||||
}
|
||||
|
||||
#define a_ctz_64 a_ctz_64
|
||||
static inline int a_ctz_64(uint64_t x)
|
||||
{
|
||||
__asm__(
|
||||
" rbit %0, %1\n"
|
||||
" clz %0, %0\n"
|
||||
: "=r"(x) : "r"(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
#define a_clz_64 a_clz_64
|
||||
static inline int a_clz_64(uint64_t x)
|
||||
{
|
||||
__asm__("clz %0, %1" : "=r"(x) : "r"(x));
|
||||
return x;
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
#define O_CREAT 0100
|
||||
#define O_EXCL 0200
|
||||
#define O_NOCTTY 0400
|
||||
#define O_TRUNC 01000
|
||||
#define O_APPEND 02000
|
||||
#define O_NONBLOCK 04000
|
||||
#define O_DSYNC 010000
|
||||
#define O_SYNC 04010000
|
||||
#define O_RSYNC 04010000
|
||||
#define O_DIRECTORY 040000
|
||||
#define O_NOFOLLOW 0100000
|
||||
#define O_CLOEXEC 02000000
|
||||
|
||||
#define O_ASYNC 020000
|
||||
#define O_DIRECT 0200000
|
||||
#define O_LARGEFILE 0400000
|
||||
#define O_NOATIME 01000000
|
||||
#define O_PATH 010000000
|
||||
#define O_TMPFILE 020040000
|
||||
#define O_NDELAY O_NONBLOCK
|
||||
|
||||
#define F_DUPFD 0
|
||||
#define F_GETFD 1
|
||||
#define F_SETFD 2
|
||||
#define F_GETFL 3
|
||||
#define F_SETFL 4
|
||||
#define F_GETLK 5
|
||||
#define F_SETLK 6
|
||||
#define F_SETLKW 7
|
||||
#define F_SETOWN 8
|
||||
#define F_GETOWN 9
|
||||
#define F_SETSIG 10
|
||||
#define F_GETSIG 11
|
||||
|
||||
#define F_SETOWN_EX 15
|
||||
#define F_GETOWN_EX 16
|
||||
|
||||
#define F_GETOWNER_UIDS 17
|
|
@ -1,19 +0,0 @@
|
|||
#define FE_INVALID 1
|
||||
#define FE_DIVBYZERO 2
|
||||
#define FE_OVERFLOW 4
|
||||
#define FE_UNDERFLOW 8
|
||||
#define FE_INEXACT 16
|
||||
#define FE_ALL_EXCEPT 31
|
||||
#define FE_TONEAREST 0
|
||||
#define FE_DOWNWARD 0x800000
|
||||
#define FE_UPWARD 0x400000
|
||||
#define FE_TOWARDZERO 0xc00000
|
||||
|
||||
typedef unsigned int fexcept_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned int __fpcr;
|
||||
unsigned int __fpsr;
|
||||
} fenv_t;
|
||||
|
||||
#define FE_DFL_ENV ((const fenv_t *) -1)
|
|
@ -1,31 +0,0 @@
|
|||
#define FLT_EVAL_METHOD 0
|
||||
|
||||
// #define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
|
||||
// #define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
|
||||
// #define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
|
||||
// #define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
|
||||
//
|
||||
// #define LDBL_MANT_DIG 113
|
||||
// #define LDBL_MIN_EXP (-16381)
|
||||
// #define LDBL_MAX_EXP 16384
|
||||
//
|
||||
// #define LDBL_DIG 33
|
||||
// #define LDBL_MIN_10_EXP (-4931)
|
||||
// #define LDBL_MAX_10_EXP 4932
|
||||
//
|
||||
// #define DECIMAL_DIG 36
|
||||
|
||||
#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
|
||||
#define LDBL_MIN 2.22507385850720138309e-308L
|
||||
#define LDBL_MAX 1.79769313486231570815e+308L
|
||||
#define LDBL_EPSILON 2.22044604925031308085e-16L
|
||||
|
||||
#define LDBL_MANT_DIG 53
|
||||
#define LDBL_MIN_EXP (-1021)
|
||||
#define LDBL_MAX_EXP 1024
|
||||
|
||||
#define LDBL_DIG 15
|
||||
#define LDBL_MIN_10_EXP (-307)
|
||||
#define LDBL_MAX_10_EXP 308
|
||||
|
||||
#define DECIMAL_DIG 17
|
|
@ -1,40 +0,0 @@
|
|||
#define HWCAP_FP (1 << 0)
|
||||
#define HWCAP_ASIMD (1 << 1)
|
||||
#define HWCAP_EVTSTRM (1 << 2)
|
||||
#define HWCAP_AES (1 << 3)
|
||||
#define HWCAP_PMULL (1 << 4)
|
||||
#define HWCAP_SHA1 (1 << 5)
|
||||
#define HWCAP_SHA2 (1 << 6)
|
||||
#define HWCAP_CRC32 (1 << 7)
|
||||
#define HWCAP_ATOMICS (1 << 8)
|
||||
#define HWCAP_FPHP (1 << 9)
|
||||
#define HWCAP_ASIMDHP (1 << 10)
|
||||
#define HWCAP_CPUID (1 << 11)
|
||||
#define HWCAP_ASIMDRDM (1 << 12)
|
||||
#define HWCAP_JSCVT (1 << 13)
|
||||
#define HWCAP_FCMA (1 << 14)
|
||||
#define HWCAP_LRCPC (1 << 15)
|
||||
#define HWCAP_DCPOP (1 << 16)
|
||||
#define HWCAP_SHA3 (1 << 17)
|
||||
#define HWCAP_SM3 (1 << 18)
|
||||
#define HWCAP_SM4 (1 << 19)
|
||||
#define HWCAP_ASIMDDP (1 << 20)
|
||||
#define HWCAP_SHA512 (1 << 21)
|
||||
#define HWCAP_SVE (1 << 22)
|
||||
#define HWCAP_ASIMDFHM (1 << 23)
|
||||
#define HWCAP_DIT (1 << 24)
|
||||
#define HWCAP_USCAT (1 << 25)
|
||||
#define HWCAP_ILRCPC (1 << 26)
|
||||
#define HWCAP_FLAGM (1 << 27)
|
||||
#define HWCAP_SSBS (1 << 28)
|
||||
#define HWCAP_SB (1 << 29)
|
||||
#define HWCAP_PACA (1 << 30)
|
||||
#define HWCAP_PACG (1UL << 31)
|
||||
|
||||
#define HWCAP2_DCPODP (1 << 0)
|
||||
#define HWCAP2_SVE2 (1 << 1)
|
||||
#define HWCAP2_SVEAES (1 << 2)
|
||||
#define HWCAP2_SVEPMULL (1 << 3)
|
||||
#define HWCAP2_SVEBITPERM (1 << 4)
|
||||
#define HWCAP2_SVESHA3 (1 << 5)
|
||||
#define HWCAP2_SVESM4 (1 << 6)
|
|
@ -1,2 +0,0 @@
|
|||
#define _POSIX_V6_LP64_OFF64 1
|
||||
#define _POSIX_V7_LP64_OFF64 1
|
|
@ -1,2 +0,0 @@
|
|||
#undef __WORDSIZE
|
||||
#define __WORDSIZE 64
|
|
@ -1 +0,0 @@
|
|||
typedef unsigned long __jmp_buf[22];
|
|
@ -1,153 +0,0 @@
|
|||
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|
||||
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
|
||||
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
#define MINSIGSTKSZ 6144
|
||||
#define SIGSTKSZ 12288
|
||||
#endif
|
||||
|
||||
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
typedef unsigned long greg_t;
|
||||
typedef unsigned long gregset_t[34];
|
||||
|
||||
typedef struct {
|
||||
long double vregs[32];
|
||||
unsigned int fpsr;
|
||||
unsigned int fpcr;
|
||||
} fpregset_t;
|
||||
typedef struct sigcontext {
|
||||
unsigned long fault_address;
|
||||
unsigned long regs[31];
|
||||
unsigned long sp, pc, pstate;
|
||||
long double __reserved[256];
|
||||
} mcontext_t;
|
||||
|
||||
#define FPSIMD_MAGIC 0x46508001
|
||||
#define ESR_MAGIC 0x45535201
|
||||
#define EXTRA_MAGIC 0x45585401
|
||||
#define SVE_MAGIC 0x53564501
|
||||
struct _aarch64_ctx {
|
||||
unsigned int magic;
|
||||
unsigned int size;
|
||||
};
|
||||
struct fpsimd_context {
|
||||
struct _aarch64_ctx head;
|
||||
unsigned int fpsr;
|
||||
unsigned int fpcr;
|
||||
long double vregs[32];
|
||||
};
|
||||
struct esr_context {
|
||||
struct _aarch64_ctx head;
|
||||
unsigned long esr;
|
||||
};
|
||||
struct extra_context {
|
||||
struct _aarch64_ctx head;
|
||||
unsigned long datap;
|
||||
unsigned int size;
|
||||
unsigned int __reserved[3];
|
||||
};
|
||||
struct sve_context {
|
||||
struct _aarch64_ctx head;
|
||||
unsigned short vl;
|
||||
unsigned short __reserved[3];
|
||||
};
|
||||
#define SVE_VQ_BYTES 16
|
||||
#define SVE_VQ_MIN 1
|
||||
#define SVE_VQ_MAX 512
|
||||
#define SVE_VL_MIN (SVE_VQ_MIN * SVE_VQ_BYTES)
|
||||
#define SVE_VL_MAX (SVE_VQ_MAX * SVE_VQ_BYTES)
|
||||
#define SVE_NUM_ZREGS 32
|
||||
#define SVE_NUM_PREGS 16
|
||||
#define sve_vl_valid(vl) \
|
||||
((vl) % SVE_VQ_BYTES == 0 && (vl) >= SVE_VL_MIN && (vl) <= SVE_VL_MAX)
|
||||
#define sve_vq_from_vl(vl) ((vl) / SVE_VQ_BYTES)
|
||||
#define sve_vl_from_vq(vq) ((vq) * SVE_VQ_BYTES)
|
||||
#define SVE_SIG_ZREG_SIZE(vq) ((unsigned)(vq) * SVE_VQ_BYTES)
|
||||
#define SVE_SIG_PREG_SIZE(vq) ((unsigned)(vq) * (SVE_VQ_BYTES / 8))
|
||||
#define SVE_SIG_FFR_SIZE(vq) SVE_SIG_PREG_SIZE(vq)
|
||||
#define SVE_SIG_REGS_OFFSET \
|
||||
((sizeof(struct sve_context) + (SVE_VQ_BYTES - 1)) \
|
||||
/ SVE_VQ_BYTES * SVE_VQ_BYTES)
|
||||
#define SVE_SIG_ZREGS_OFFSET SVE_SIG_REGS_OFFSET
|
||||
#define SVE_SIG_ZREG_OFFSET(vq, n) \
|
||||
(SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREG_SIZE(vq) * (n))
|
||||
#define SVE_SIG_ZREGS_SIZE(vq) \
|
||||
(SVE_SIG_ZREG_OFFSET(vq, SVE_NUM_ZREGS) - SVE_SIG_ZREGS_OFFSET)
|
||||
#define SVE_SIG_PREGS_OFFSET(vq) \
|
||||
(SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREGS_SIZE(vq))
|
||||
#define SVE_SIG_PREG_OFFSET(vq, n) \
|
||||
(SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREG_SIZE(vq) * (n))
|
||||
#define SVE_SIG_PREGS_SIZE(vq) \
|
||||
(SVE_SIG_PREG_OFFSET(vq, SVE_NUM_PREGS) - SVE_SIG_PREGS_OFFSET(vq))
|
||||
#define SVE_SIG_FFR_OFFSET(vq) \
|
||||
(SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREGS_SIZE(vq))
|
||||
#define SVE_SIG_REGS_SIZE(vq) \
|
||||
(SVE_SIG_FFR_OFFSET(vq) + SVE_SIG_FFR_SIZE(vq) - SVE_SIG_REGS_OFFSET)
|
||||
#define SVE_SIG_CONTEXT_SIZE(vq) (SVE_SIG_REGS_OFFSET + SVE_SIG_REGS_SIZE(vq))
|
||||
#else
|
||||
typedef struct {
|
||||
long double __regs[18+256];
|
||||
} mcontext_t;
|
||||
#endif
|
||||
|
||||
struct sigaltstack {
|
||||
void *ss_sp;
|
||||
int ss_flags;
|
||||
size_t ss_size;
|
||||
};
|
||||
|
||||
typedef struct __ucontext {
|
||||
unsigned long uc_flags;
|
||||
struct __ucontext *uc_link;
|
||||
stack_t uc_stack;
|
||||
sigset_t uc_sigmask;
|
||||
mcontext_t uc_mcontext;
|
||||
} ucontext_t;
|
||||
|
||||
#define SA_NOCLDSTOP 1
|
||||
#define SA_NOCLDWAIT 2
|
||||
#define SA_SIGINFO 4
|
||||
#define SA_ONSTACK 0x08000000
|
||||
#define SA_RESTART 0x10000000
|
||||
#define SA_NODEFER 0x40000000
|
||||
#define SA_RESETHAND 0x80000000
|
||||
#define SA_RESTORER 0x04000000
|
||||
|
||||
#endif
|
||||
|
||||
#define SIGHUP 1
|
||||
#define SIGINT 2
|
||||
#define SIGQUIT 3
|
||||
#define SIGILL 4
|
||||
#define SIGTRAP 5
|
||||
#define SIGABRT 6
|
||||
#define SIGIOT SIGABRT
|
||||
#define SIGBUS 7
|
||||
#define SIGFPE 8
|
||||
#define SIGKILL 9
|
||||
#define SIGUSR1 10
|
||||
#define SIGSEGV 11
|
||||
#define SIGUSR2 12
|
||||
#define SIGPIPE 13
|
||||
#define SIGALRM 14
|
||||
#define SIGTERM 15
|
||||
#define SIGSTKFLT 16
|
||||
#define SIGCHLD 17
|
||||
#define SIGCONT 18
|
||||
#define SIGSTOP 19
|
||||
#define SIGTSTP 20
|
||||
#define SIGTTIN 21
|
||||
#define SIGTTOU 22
|
||||
#define SIGURG 23
|
||||
#define SIGXCPU 24
|
||||
#define SIGXFSZ 25
|
||||
#define SIGVTALRM 26
|
||||
#define SIGPROF 27
|
||||
#define SIGWINCH 28
|
||||
#define SIGIO 29
|
||||
#define SIGPOLL 29
|
||||
#define SIGPWR 30
|
||||
#define SIGSYS 31
|
||||
#define SIGUNUSED SIGSYS
|
||||
|
||||
#define _NSIG 65
|
|
@ -1,18 +0,0 @@
|
|||
struct stat {
|
||||
dev_t st_dev;
|
||||
ino_t st_ino;
|
||||
mode_t st_mode;
|
||||
nlink_t st_nlink;
|
||||
uid_t st_uid;
|
||||
gid_t st_gid;
|
||||
dev_t st_rdev;
|
||||
unsigned long __pad;
|
||||
off_t st_size;
|
||||
blksize_t st_blksize;
|
||||
int __pad2;
|
||||
blkcnt_t st_blocks;
|
||||
struct timespec st_atim;
|
||||
struct timespec st_mtim;
|
||||
struct timespec st_ctim;
|
||||
unsigned __unused[2];
|
||||
};
|
|
@ -1,20 +0,0 @@
|
|||
typedef int32_t int_fast16_t;
|
||||
typedef int32_t int_fast32_t;
|
||||
typedef uint32_t uint_fast16_t;
|
||||
typedef uint32_t uint_fast32_t;
|
||||
|
||||
#define INT_FAST16_MIN INT32_MIN
|
||||
#define INT_FAST32_MIN INT32_MIN
|
||||
|
||||
#define INT_FAST16_MAX INT32_MAX
|
||||
#define INT_FAST32_MAX INT32_MAX
|
||||
|
||||
#define UINT_FAST16_MAX UINT32_MAX
|
||||
#define UINT_FAST32_MAX UINT32_MAX
|
||||
|
||||
#define INTPTR_MIN INT64_MIN
|
||||
#define INTPTR_MAX INT64_MAX
|
||||
#define UINTPTR_MAX UINT64_MAX
|
||||
#define PTRDIFF_MIN INT64_MIN
|
||||
#define PTRDIFF_MAX INT64_MAX
|
||||
#define SIZE_MAX UINT64_MAX
|
|
@ -1,16 +0,0 @@
|
|||
struct user_regs_struct {
|
||||
unsigned long long regs[31];
|
||||
unsigned long long sp;
|
||||
unsigned long long pc;
|
||||
unsigned long long pstate;
|
||||
};
|
||||
|
||||
struct user_fpsimd_struct {
|
||||
long double vregs[32];
|
||||
unsigned int fpsr;
|
||||
unsigned int fpcr;
|
||||
};
|
||||
|
||||
#define ELF_NREG 34
|
||||
typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NREG];
|
||||
typedef struct user_fpsimd_struct elf_fpregset_t;
|
|
@ -1,15 +0,0 @@
|
|||
__asm__(
|
||||
".text \n"
|
||||
".global " START "\n"
|
||||
".type " START ",%function\n"
|
||||
START ":\n"
|
||||
" mov x29, #0\n"
|
||||
" mov x30, #0\n"
|
||||
" mov x0, sp\n"
|
||||
".weak _DYNAMIC\n"
|
||||
".hidden _DYNAMIC\n"
|
||||
" adrp x1, _DYNAMIC\n"
|
||||
" add x1, x1, #:lo12:_DYNAMIC\n"
|
||||
" and sp, x0, #-16\n"
|
||||
" b " START "_c\n"
|
||||
);
|
|
@ -1,25 +0,0 @@
|
|||
#define fp_barrierf fp_barrierf
|
||||
static inline float fp_barrierf(float x)
|
||||
{
|
||||
__asm__ __volatile__ ("" : "+w"(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
#define fp_barrier fp_barrier
|
||||
static inline double fp_barrier(double x)
|
||||
{
|
||||
__asm__ __volatile__ ("" : "+w"(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
#define fp_force_evalf fp_force_evalf
|
||||
static inline void fp_force_evalf(float x)
|
||||
{
|
||||
__asm__ __volatile__ ("" : "+w"(x));
|
||||
}
|
||||
|
||||
#define fp_force_eval fp_force_eval
|
||||
static inline void fp_force_eval(double x)
|
||||
{
|
||||
__asm__ __volatile__ ("" : "+w"(x));
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
struct kstat {
|
||||
dev_t st_dev;
|
||||
ino_t st_ino;
|
||||
mode_t st_mode;
|
||||
nlink_t st_nlink;
|
||||
uid_t st_uid;
|
||||
gid_t st_gid;
|
||||
dev_t st_rdev;
|
||||
unsigned long __pad;
|
||||
off_t st_size;
|
||||
blksize_t st_blksize;
|
||||
int __pad2;
|
||||
blkcnt_t st_blocks;
|
||||
long st_atime_sec;
|
||||
long st_atime_nsec;
|
||||
long st_mtime_sec;
|
||||
long st_mtime_nsec;
|
||||
long st_ctime_sec;
|
||||
long st_ctime_nsec;
|
||||
unsigned __unused[2];
|
||||
};
|
|
@ -1,12 +0,0 @@
|
|||
static inline struct pthread *__pthread_self()
|
||||
{
|
||||
char *self;
|
||||
__asm__ ("mrs %0,tpidr_el0" : "=r"(self));
|
||||
return (void*)(self - sizeof(struct pthread));
|
||||
}
|
||||
|
||||
#define TLS_ABOVE_TP
|
||||
#define GAP_ABOVE_TP 16
|
||||
#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread))
|
||||
|
||||
#define MC_PC pc
|
|
@ -1,24 +0,0 @@
|
|||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
#define ENDIAN_SUFFIX "_be"
|
||||
#else
|
||||
#define ENDIAN_SUFFIX ""
|
||||
#endif
|
||||
|
||||
#define LDSO_ARCH "aarch64" ENDIAN_SUFFIX
|
||||
|
||||
#define NO_LEGACY_INITFINI
|
||||
|
||||
#define TPOFF_K 0
|
||||
|
||||
#define REL_SYMBOLIC R_AARCH64_ABS64
|
||||
#define REL_GOT R_AARCH64_GLOB_DAT
|
||||
#define REL_PLT R_AARCH64_JUMP_SLOT
|
||||
#define REL_RELATIVE R_AARCH64_RELATIVE
|
||||
#define REL_COPY R_AARCH64_COPY
|
||||
#define REL_DTPMOD R_AARCH64_TLS_DTPMOD64
|
||||
#define REL_DTPOFF R_AARCH64_TLS_DTPREL64
|
||||
#define REL_TPOFF R_AARCH64_TLS_TPREL64
|
||||
#define REL_TLSDESC R_AARCH64_TLSDESC
|
||||
|
||||
#define CRTJMP(pc,sp) __asm__ __volatile__( \
|
||||
"mov sp,%1 ; br %0" : : "r"(pc), "r"(sp) : "memory" )
|
|
@ -1,78 +0,0 @@
|
|||
#define __SYSCALL_LL_E(x) (x)
|
||||
#define __SYSCALL_LL_O(x) (x)
|
||||
|
||||
#define __asm_syscall(...) do { \
|
||||
__asm__ __volatile__ ( "svc 0" \
|
||||
: "=r"(x0) : __VA_ARGS__ : "memory", "cc"); \
|
||||
return x0; \
|
||||
} while (0)
|
||||
|
||||
inline long __syscall0(long n)
|
||||
{
|
||||
register long x8 __asm__("x8") = n;
|
||||
register long x0 __asm__("x0");
|
||||
__asm_syscall("r"(x8));
|
||||
}
|
||||
|
||||
inline long __syscall1(long n, long a)
|
||||
{
|
||||
register long x8 __asm__("x8") = n;
|
||||
register long x0 __asm__("x0") = a;
|
||||
__asm_syscall("r"(x8), "0"(x0));
|
||||
}
|
||||
|
||||
inline long __syscall2(long n, long a, long b)
|
||||
{
|
||||
register long x8 __asm__("x8") = n;
|
||||
register long x0 __asm__("x0") = a;
|
||||
register long x1 __asm__("x1") = b;
|
||||
__asm_syscall("r"(x8), "0"(x0), "r"(x1));
|
||||
}
|
||||
|
||||
inline long __syscall3(long n, long a, long b, long c)
|
||||
{
|
||||
register long x8 __asm__("x8") = n;
|
||||
register long x0 __asm__("x0") = a;
|
||||
register long x1 __asm__("x1") = b;
|
||||
register long x2 __asm__("x2") = c;
|
||||
__asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2));
|
||||
}
|
||||
|
||||
inline long __syscall4(long n, long a, long b, long c, long d)
|
||||
{
|
||||
register long x8 __asm__("x8") = n;
|
||||
register long x0 __asm__("x0") = a;
|
||||
register long x1 __asm__("x1") = b;
|
||||
register long x2 __asm__("x2") = c;
|
||||
register long x3 __asm__("x3") = d;
|
||||
__asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3));
|
||||
}
|
||||
|
||||
inline long __syscall5(long n, long a, long b, long c, long d, long e)
|
||||
{
|
||||
register long x8 __asm__("x8") = n;
|
||||
register long x0 __asm__("x0") = a;
|
||||
register long x1 __asm__("x1") = b;
|
||||
register long x2 __asm__("x2") = c;
|
||||
register long x3 __asm__("x3") = d;
|
||||
register long x4 __asm__("x4") = e;
|
||||
__asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4));
|
||||
}
|
||||
|
||||
inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
|
||||
{
|
||||
register long x8 __asm__("x8") = n;
|
||||
register long x0 __asm__("x0") = a;
|
||||
register long x1 __asm__("x1") = b;
|
||||
register long x2 __asm__("x2") = c;
|
||||
register long x3 __asm__("x3") = d;
|
||||
register long x4 __asm__("x4") = e;
|
||||
register long x5 __asm__("x5") = f;
|
||||
__asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4), "r"(x5));
|
||||
}
|
||||
|
||||
#define VDSO_USEFUL
|
||||
#define VDSO_CGT_SYM "__kernel_clock_gettime"
|
||||
#define VDSO_CGT_VER "LINUX_2.6.39"
|
||||
|
||||
#define IPC_64 0
|
|
@ -1,109 +0,0 @@
|
|||
#include "libc.h"
|
||||
|
||||
#if __ARM_ARCH_4__ || __ARM_ARCH_4T__ || __ARM_ARCH == 4
|
||||
#define BLX "mov lr,pc\n\tbx"
|
||||
#else
|
||||
#define BLX "blx"
|
||||
#endif
|
||||
|
||||
extern hidden uintptr_t __a_cas_ptr, __a_barrier_ptr;
|
||||
|
||||
#if ((__ARM_ARCH_6__ || __ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \
|
||||
|| __ARM_ARCH_6T2__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
|
||||
|
||||
#define a_ll a_ll
|
||||
static inline int a_ll(volatile int *p)
|
||||
{
|
||||
int v;
|
||||
__asm__ __volatile__ ("ldrex %0, %1" : "=r"(v) : "Q"(*p));
|
||||
return v;
|
||||
}
|
||||
|
||||
#define a_sc a_sc
|
||||
static inline int a_sc(volatile int *p, int v)
|
||||
{
|
||||
int r;
|
||||
__asm__ __volatile__ ("strex %0,%2,%1" : "=&r"(r), "=Q"(*p) : "r"(v) : "memory");
|
||||
return !r;
|
||||
}
|
||||
|
||||
#if __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
|
||||
|
||||
#define a_barrier a_barrier
|
||||
static inline void a_barrier()
|
||||
{
|
||||
__asm__ __volatile__ ("dmb ish" : : : "memory");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define a_pre_llsc a_barrier
|
||||
#define a_post_llsc a_barrier
|
||||
|
||||
#else
|
||||
|
||||
#define a_cas a_cas
|
||||
static inline int a_cas(volatile int *p, int t, int s)
|
||||
{
|
||||
__asm__ __volatile__ ("TODO");
|
||||
//TODO for (;;) {
|
||||
//TODO register int r0 __asm__("r0") = t;
|
||||
//TODO register int r1 __asm__("r1") = s;
|
||||
//TODO register volatile int *r2 __asm__("r2") = p;
|
||||
//TODO register uintptr_t r3 __asm__("r3") = __a_cas_ptr;
|
||||
//TODO int old;
|
||||
//TODO __asm__ __volatile__ (
|
||||
//TODO BLX " r3"
|
||||
//TODO : "+r"(r0), "+r"(r3) : "r"(r1), "r"(r2)
|
||||
//TODO : "memory", "lr", "ip", "cc" );
|
||||
//TODO if (!r0) return t;
|
||||
//TODO if ((old=*p)!=t) return old;
|
||||
//TODO }
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef a_barrier
|
||||
#define a_barrier a_barrier
|
||||
static inline void a_barrier()
|
||||
{
|
||||
__asm__ __volatile__ ("TODO");
|
||||
//TODO register uintptr_t ip __asm__("ip") = __a_barrier_ptr;
|
||||
//TODO __asm__ __volatile__( BLX " ip" : "+r"(ip) : : "memory", "cc", "lr" );
|
||||
}
|
||||
#endif
|
||||
|
||||
#define a_crash a_crash
|
||||
static inline void a_crash()
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
#ifndef __thumb__
|
||||
".word 0xe7f000f0"
|
||||
#else
|
||||
".short 0xdeff"
|
||||
#endif
|
||||
: : : "memory");
|
||||
}
|
||||
|
||||
#if __ARM_ARCH >= 5 && (!__thumb__ || __thumb2__)
|
||||
|
||||
#define a_clz_32 a_clz_32
|
||||
static inline int a_clz_32(uint32_t x)
|
||||
{
|
||||
__asm__ ("clz %0, %1" : "=r"(x) : "r"(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
#if __ARM_ARCH_6T2__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
|
||||
|
||||
#define a_ctz_32 a_ctz_32
|
||||
static inline int a_ctz_32(uint32_t x)
|
||||
{
|
||||
uint32_t xr;
|
||||
__asm__ ("rbit %0, %1" : "=r"(xr) : "r"(x));
|
||||
return a_clz_32(xr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,40 +0,0 @@
|
|||
#define O_CREAT 0100
|
||||
#define O_EXCL 0200
|
||||
#define O_NOCTTY 0400
|
||||
#define O_TRUNC 01000
|
||||
#define O_APPEND 02000
|
||||
#define O_NONBLOCK 04000
|
||||
#define O_DSYNC 010000
|
||||
#define O_SYNC 04010000
|
||||
#define O_RSYNC 04010000
|
||||
#define O_DIRECTORY 040000
|
||||
#define O_NOFOLLOW 0100000
|
||||
#define O_CLOEXEC 02000000
|
||||
|
||||
#define O_ASYNC 020000
|
||||
#define O_DIRECT 0200000
|
||||
#define O_LARGEFILE 0400000
|
||||
#define O_NOATIME 01000000
|
||||
#define O_PATH 010000000
|
||||
#define O_TMPFILE 020040000
|
||||
#define O_NDELAY O_NONBLOCK
|
||||
|
||||
#define F_DUPFD 0
|
||||
#define F_GETFD 1
|
||||
#define F_SETFD 2
|
||||
#define F_GETFL 3
|
||||
#define F_SETFL 4
|
||||
|
||||
#define F_SETOWN 8
|
||||
#define F_GETOWN 9
|
||||
#define F_SETSIG 10
|
||||
#define F_GETSIG 11
|
||||
|
||||
#define F_GETLK 12
|
||||
#define F_SETLK 13
|
||||
#define F_SETLKW 14
|
||||
|
||||
#define F_SETOWN_EX 15
|
||||
#define F_GETOWN_EX 16
|
||||
|
||||
#define F_GETOWNER_UIDS 17
|
|
@ -1,23 +0,0 @@
|
|||
#ifndef __ARM_PCS_VFP
|
||||
#define FE_ALL_EXCEPT 0
|
||||
#define FE_TONEAREST 0
|
||||
#else
|
||||
#define FE_INVALID 1
|
||||
#define FE_DIVBYZERO 2
|
||||
#define FE_OVERFLOW 4
|
||||
#define FE_UNDERFLOW 8
|
||||
#define FE_INEXACT 16
|
||||
#define FE_ALL_EXCEPT 31
|
||||
#define FE_TONEAREST 0
|
||||
#define FE_DOWNWARD 0x800000
|
||||
#define FE_UPWARD 0x400000
|
||||
#define FE_TOWARDZERO 0xc00000
|
||||
#endif
|
||||
|
||||
typedef unsigned long fexcept_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned long __cw;
|
||||
} fenv_t;
|
||||
|
||||
#define FE_DFL_ENV ((const fenv_t *) -1)
|
|
@ -1,16 +0,0 @@
|
|||
#define FLT_EVAL_METHOD 0
|
||||
|
||||
#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
|
||||
#define LDBL_MIN 2.22507385850720138309e-308L
|
||||
#define LDBL_MAX 1.79769313486231570815e+308L
|
||||
#define LDBL_EPSILON 2.22044604925031308085e-16L
|
||||
|
||||
#define LDBL_MANT_DIG 53
|
||||
#define LDBL_MIN_EXP (-1021)
|
||||
#define LDBL_MAX_EXP 1024
|
||||
|
||||
#define LDBL_DIG 15
|
||||
#define LDBL_MIN_10_EXP (-307)
|
||||
#define LDBL_MAX_10_EXP 308
|
||||
|
||||
#define DECIMAL_DIG 17
|
|
@ -1,53 +0,0 @@
|
|||
#define HWCAP_SWP (1 << 0)
|
||||
#define HWCAP_HALF (1 << 1)
|
||||
#define HWCAP_THUMB (1 << 2)
|
||||
#define HWCAP_26BIT (1 << 3)
|
||||
#define HWCAP_FAST_MULT (1 << 4)
|
||||
#define HWCAP_FPA (1 << 5)
|
||||
#define HWCAP_VFP (1 << 6)
|
||||
#define HWCAP_EDSP (1 << 7)
|
||||
#define HWCAP_JAVA (1 << 8)
|
||||
#define HWCAP_IWMMXT (1 << 9)
|
||||
#define HWCAP_CRUNCH (1 << 10)
|
||||
#define HWCAP_THUMBEE (1 << 11)
|
||||
#define HWCAP_NEON (1 << 12)
|
||||
#define HWCAP_VFPv3 (1 << 13)
|
||||
#define HWCAP_VFPv3D16 (1 << 14)
|
||||
#define HWCAP_TLS (1 << 15)
|
||||
#define HWCAP_VFPv4 (1 << 16)
|
||||
#define HWCAP_IDIVA (1 << 17)
|
||||
#define HWCAP_IDIVT (1 << 18)
|
||||
#define HWCAP_VFPD32 (1 << 19)
|
||||
#define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT)
|
||||
#define HWCAP_LPAE (1 << 20)
|
||||
#define HWCAP_EVTSTRM (1 << 21)
|
||||
|
||||
#define HWCAP2_AES (1 << 0)
|
||||
#define HWCAP2_PMULL (1 << 1)
|
||||
#define HWCAP2_SHA1 (1 << 2)
|
||||
#define HWCAP2_SHA2 (1 << 3)
|
||||
#define HWCAP2_CRC32 (1 << 4)
|
||||
|
||||
#define HWCAP_ARM_SWP (1 << 0)
|
||||
#define HWCAP_ARM_HALF (1 << 1)
|
||||
#define HWCAP_ARM_THUMB (1 << 2)
|
||||
#define HWCAP_ARM_26BIT (1 << 3)
|
||||
#define HWCAP_ARM_FAST_MULT (1 << 4)
|
||||
#define HWCAP_ARM_FPA (1 << 5)
|
||||
#define HWCAP_ARM_VFP (1 << 6)
|
||||
#define HWCAP_ARM_EDSP (1 << 7)
|
||||
#define HWCAP_ARM_JAVA (1 << 8)
|
||||
#define HWCAP_ARM_IWMMXT (1 << 9)
|
||||
#define HWCAP_ARM_CRUNCH (1 << 10)
|
||||
#define HWCAP_ARM_THUMBEE (1 << 11)
|
||||
#define HWCAP_ARM_NEON (1 << 12)
|
||||
#define HWCAP_ARM_VFPv3 (1 << 13)
|
||||
#define HWCAP_ARM_VFPv3D16 (1 << 14)
|
||||
#define HWCAP_ARM_TLS (1 << 15)
|
||||
#define HWCAP_ARM_VFPv4 (1 << 16)
|
||||
#define HWCAP_ARM_IDIVA (1 << 17)
|
||||
#define HWCAP_ARM_IDIVT (1 << 18)
|
||||
#define HWCAP_ARM_VFPD32 (1 << 19)
|
||||
#define HWCAP_ARM_IDIV (HWCAP_ARM_IDIVA | HWCAP_ARM_IDIVT)
|
||||
#define HWCAP_ARM_LPAE (1 << 20)
|
||||
#define HWCAP_ARM_EVTSTRM (1 << 21)
|
|
@ -1,2 +0,0 @@
|
|||
#undef FIOQSIZE
|
||||
#define FIOQSIZE 0x545e
|
|
@ -1 +0,0 @@
|
|||
#define IPC_STAT 0x102
|
|
@ -1,18 +0,0 @@
|
|||
struct msqid_ds {
|
||||
struct ipc_perm msg_perm;
|
||||
unsigned long __msg_stime_lo;
|
||||
unsigned long __msg_stime_hi;
|
||||
unsigned long __msg_rtime_lo;
|
||||
unsigned long __msg_rtime_hi;
|
||||
unsigned long __msg_ctime_lo;
|
||||
unsigned long __msg_ctime_hi;
|
||||
unsigned long msg_cbytes;
|
||||
msgqnum_t msg_qnum;
|
||||
msglen_t msg_qbytes;
|
||||
pid_t msg_lspid;
|
||||
pid_t msg_lrpid;
|
||||
unsigned long __unused[2];
|
||||
time_t msg_stime;
|
||||
time_t msg_rtime;
|
||||
time_t msg_ctime;
|
||||
};
|
|
@ -1,2 +0,0 @@
|
|||
#define _POSIX_V6_ILP32_OFFBIG 1
|
||||
#define _POSIX_V7_ILP32_OFFBIG 1
|
|
@ -1,25 +0,0 @@
|
|||
#define PTRACE_GETWMMXREGS 18
|
||||
#define PTRACE_SETWMMXREGS 19
|
||||
#define PTRACE_GET_THREAD_AREA 22
|
||||
#define PTRACE_SET_SYSCALL 23
|
||||
#define PTRACE_GETCRUNCHREGS 25
|
||||
#define PTRACE_SETCRUNCHREGS 26
|
||||
#define PTRACE_GETVFPREGS 27
|
||||
#define PTRACE_SETVFPREGS 28
|
||||
#define PTRACE_GETHBPREGS 29
|
||||
#define PTRACE_SETHBPREGS 30
|
||||
#define PTRACE_GETFDPIC 31
|
||||
#define PTRACE_GETFDPIC_EXEC 0
|
||||
#define PTRACE_GETFDPIC_INTERP 1
|
||||
|
||||
#define PT_GETWMMXREGS PTRACE_GETWMMXREGS
|
||||
#define PT_SETWMMXREGS PTRACE_SETWMMXREGS
|
||||
#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA
|
||||
#define PT_SET_SYSCALL PTRACE_SET_SYSCALL
|
||||
#define PT_GETCRUNCHREGS PTRACE_GETCRUNCHREGS
|
||||
#define PT_SETCRUNCHREGS PTRACE_SETCRUNCHREGS
|
||||
#define PT_GETVFPREGS PTRACE_GETVFPREGS
|
||||
#define PT_SETVFPREGS PTRACE_SETVFPREGS
|
||||
#define PT_GETHBPREGS PTRACE_GETHBPREGS
|
||||
#define PT_SETHBPREGS PTRACE_SETHBPREGS
|
||||
#define PT_GETFDPIC PTRACE_GETFDPIC
|
|
@ -1,3 +0,0 @@
|
|||
#undef __WORDSIZE
|
||||
#define __WORDSIZE 32
|
||||
/* FIXME */
|
|
@ -1,18 +0,0 @@
|
|||
struct semid_ds {
|
||||
struct ipc_perm sem_perm;
|
||||
unsigned long __sem_otime_lo;
|
||||
unsigned long __sem_otime_hi;
|
||||
unsigned long __sem_ctime_lo;
|
||||
unsigned long __sem_ctime_hi;
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
unsigned short sem_nsems;
|
||||
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
|
||||
#else
|
||||
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
|
||||
unsigned short sem_nsems;
|
||||
#endif
|
||||
long __unused3;
|
||||
long __unused4;
|
||||
time_t sem_otime;
|
||||
time_t sem_ctime;
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
typedef unsigned long long __jmp_buf[32];
|
|
@ -1,31 +0,0 @@
|
|||
#define SHMLBA 4096
|
||||
|
||||
struct shmid_ds {
|
||||
struct ipc_perm shm_perm;
|
||||
size_t shm_segsz;
|
||||
unsigned long __shm_atime_lo;
|
||||
unsigned long __shm_atime_hi;
|
||||
unsigned long __shm_dtime_lo;
|
||||
unsigned long __shm_dtime_hi;
|
||||
unsigned long __shm_ctime_lo;
|
||||
unsigned long __shm_ctime_hi;
|
||||
pid_t shm_cpid;
|
||||
pid_t shm_lpid;
|
||||
unsigned long shm_nattch;
|
||||
unsigned long __pad1;
|
||||
unsigned long __pad2;
|
||||
unsigned long __pad3;
|
||||
time_t shm_atime;
|
||||
time_t shm_dtime;
|
||||
time_t shm_ctime;
|
||||
};
|
||||
|
||||
struct shminfo {
|
||||
unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
|
||||
};
|
||||
|
||||
struct shm_info {
|
||||
int __used_ids;
|
||||
unsigned long shm_tot, shm_rss, shm_swp;
|
||||
unsigned long __swap_attempts, __swap_successes;
|
||||
};
|
|
@ -1,86 +0,0 @@
|
|||
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|
||||
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
|
||||
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
#define MINSIGSTKSZ 2048
|
||||
#define SIGSTKSZ 8192
|
||||
#endif
|
||||
|
||||
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
typedef int greg_t, gregset_t[18];
|
||||
typedef struct sigcontext {
|
||||
unsigned long trap_no, error_code, oldmask;
|
||||
unsigned long arm_r0, arm_r1, arm_r2, arm_r3;
|
||||
unsigned long arm_r4, arm_r5, arm_r6, arm_r7;
|
||||
unsigned long arm_r8, arm_r9, arm_r10, arm_fp;
|
||||
unsigned long arm_ip, arm_sp, arm_lr, arm_pc;
|
||||
unsigned long arm_cpsr, fault_address;
|
||||
} mcontext_t;
|
||||
#else
|
||||
typedef struct {
|
||||
unsigned long __regs[21];
|
||||
} mcontext_t;
|
||||
#endif
|
||||
|
||||
struct sigaltstack {
|
||||
void *ss_sp;
|
||||
int ss_flags;
|
||||
size_t ss_size;
|
||||
};
|
||||
|
||||
typedef struct __ucontext {
|
||||
unsigned long uc_flags;
|
||||
struct __ucontext *uc_link;
|
||||
stack_t uc_stack;
|
||||
mcontext_t uc_mcontext;
|
||||
sigset_t uc_sigmask;
|
||||
unsigned long long uc_regspace[64];
|
||||
} ucontext_t;
|
||||
|
||||
#define SA_NOCLDSTOP 1
|
||||
#define SA_NOCLDWAIT 2
|
||||
#define SA_SIGINFO 4
|
||||
#define SA_ONSTACK 0x08000000
|
||||
#define SA_RESTART 0x10000000
|
||||
#define SA_NODEFER 0x40000000
|
||||
#define SA_RESETHAND 0x80000000
|
||||
#define SA_RESTORER 0x04000000
|
||||
|
||||
#endif
|
||||
|
||||
#define SIGHUP 1
|
||||
#define SIGINT 2
|
||||
#define SIGQUIT 3
|
||||
#define SIGILL 4
|
||||
#define SIGTRAP 5
|
||||
#define SIGABRT 6
|
||||
#define SIGIOT SIGABRT
|
||||
#define SIGBUS 7
|
||||
#define SIGFPE 8
|
||||
#define SIGKILL 9
|
||||
#define SIGUSR1 10
|
||||
#define SIGSEGV 11
|
||||
#define SIGUSR2 12
|
||||
#define SIGPIPE 13
|
||||
#define SIGALRM 14
|
||||
#define SIGTERM 15
|
||||
#define SIGSTKFLT 16
|
||||
#define SIGCHLD 17
|
||||
#define SIGCONT 18
|
||||
#define SIGSTOP 19
|
||||
#define SIGTSTP 20
|
||||
#define SIGTTIN 21
|
||||
#define SIGTTOU 22
|
||||
#define SIGURG 23
|
||||
#define SIGXCPU 24
|
||||
#define SIGXFSZ 25
|
||||
#define SIGVTALRM 26
|
||||
#define SIGPROF 27
|
||||
#define SIGWINCH 28
|
||||
#define SIGIO 29
|
||||
#define SIGPOLL 29
|
||||
#define SIGPWR 30
|
||||
#define SIGSYS 31
|
||||
#define SIGUNUSED SIGSYS
|
||||
|
||||
#define _NSIG 65
|
|
@ -1,25 +0,0 @@
|
|||
/* copied from kernel definition, but with padding replaced
|
||||
* by the corresponding correctly-sized userspace types. */
|
||||
|
||||
struct stat {
|
||||
dev_t st_dev;
|
||||
int __st_dev_padding;
|
||||
long __st_ino_truncated;
|
||||
mode_t st_mode;
|
||||
nlink_t st_nlink;
|
||||
uid_t st_uid;
|
||||
gid_t st_gid;
|
||||
dev_t st_rdev;
|
||||
int __st_rdev_padding;
|
||||
off_t st_size;
|
||||
blksize_t st_blksize;
|
||||
blkcnt_t st_blocks;
|
||||
struct {
|
||||
long tv_sec;
|
||||
long tv_nsec;
|
||||
} __st_atim32, __st_mtim32, __st_ctim32;
|
||||
ino_t st_ino;
|
||||
struct timespec st_atim;
|
||||
struct timespec st_mtim;
|
||||
struct timespec st_ctim;
|
||||
};
|
|
@ -1,20 +0,0 @@
|
|||
typedef int32_t int_fast16_t;
|
||||
typedef int32_t int_fast32_t;
|
||||
typedef uint32_t uint_fast16_t;
|
||||
typedef uint32_t uint_fast32_t;
|
||||
|
||||
#define INT_FAST16_MIN INT32_MIN
|
||||
#define INT_FAST32_MIN INT32_MIN
|
||||
|
||||
#define INT_FAST16_MAX INT32_MAX
|
||||
#define INT_FAST32_MAX INT32_MAX
|
||||
|
||||
#define UINT_FAST16_MAX UINT32_MAX
|
||||
#define UINT_FAST32_MAX UINT32_MAX
|
||||
|
||||
#define INTPTR_MIN INT32_MIN
|
||||
#define INTPTR_MAX INT32_MAX
|
||||
#define UINTPTR_MAX UINT32_MAX
|
||||
#define PTRDIFF_MIN INT32_MIN
|
||||
#define PTRDIFF_MAX INT32_MAX
|
||||
#define SIZE_MAX UINT32_MAX
|
|
@ -1,36 +0,0 @@
|
|||
typedef struct user_fpregs {
|
||||
struct fp_reg {
|
||||
unsigned sign1:1;
|
||||
unsigned unused:15;
|
||||
unsigned sign2:1;
|
||||
unsigned exponent:14;
|
||||
unsigned j:1;
|
||||
unsigned mantissa1:31;
|
||||
unsigned mantissa0:32;
|
||||
} fpregs[8];
|
||||
unsigned fpsr:32;
|
||||
unsigned fpcr:32;
|
||||
unsigned char ftype[8];
|
||||
unsigned int init_flag;
|
||||
} elf_fpregset_t;
|
||||
|
||||
struct user_regs {
|
||||
unsigned long uregs[18];
|
||||
};
|
||||
#define ELF_NGREG 18
|
||||
typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
|
||||
|
||||
struct user {
|
||||
struct user_regs regs;
|
||||
int u_fpvalid;
|
||||
unsigned long u_tsize, u_dsize, u_ssize;
|
||||
unsigned long start_code, start_stack;
|
||||
long signal;
|
||||
int reserved;
|
||||
struct user_regs *u_ar0;
|
||||
unsigned long magic;
|
||||
char u_comm[32];
|
||||
int u_debugreg[8];
|
||||
struct user_fpregs u_fp;
|
||||
struct user_fpregs *u_fp0;
|
||||
};
|
|
@ -1,18 +0,0 @@
|
|||
__asm__(
|
||||
".text \n"
|
||||
".global " START " \n"
|
||||
".type " START ",%function \n"
|
||||
START ": \n"
|
||||
" mov fp, #0 \n"
|
||||
" mov lr, #0 \n"
|
||||
" ldr a2, 1f \n"
|
||||
" add a2, pc, a2 \n"
|
||||
" mov a1, sp \n"
|
||||
"2: and ip, a1, #-16 \n"
|
||||
" mov sp, ip \n"
|
||||
" bl " START "_c \n"
|
||||
".weak _DYNAMIC \n"
|
||||
".hidden _DYNAMIC \n"
|
||||
".align 2 \n"
|
||||
"1: .word _DYNAMIC-2b \n"
|
||||
);
|
|
@ -1,21 +0,0 @@
|
|||
struct kstat {
|
||||
dev_t st_dev;
|
||||
int __st_dev_padding;
|
||||
long __st_ino_truncated;
|
||||
mode_t st_mode;
|
||||
nlink_t st_nlink;
|
||||
uid_t st_uid;
|
||||
gid_t st_gid;
|
||||
dev_t st_rdev;
|
||||
int __st_rdev_padding;
|
||||
off_t st_size;
|
||||
blksize_t st_blksize;
|
||||
blkcnt_t st_blocks;
|
||||
long st_atime_sec;
|
||||
long st_atime_nsec;
|
||||
long st_mtime_sec;
|
||||
long st_mtime_nsec;
|
||||
long st_ctime_sec;
|
||||
long st_ctime_nsec;
|
||||
ino_t st_ino;
|
||||
};
|
|
@ -1,33 +0,0 @@
|
|||
#if ((__ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \
|
||||
|| __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
|
||||
|
||||
static inline pthread_t __pthread_self()
|
||||
{
|
||||
char *p;
|
||||
__asm__ ( "mrc p15,0,%0,c13,c0,3" : "=r"(p) );
|
||||
return (void *)(p-sizeof(struct pthread));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if __ARM_ARCH_4__ || __ARM_ARCH_4T__ || __ARM_ARCH == 4
|
||||
#define BLX "mov lr,pc\n\tbx"
|
||||
#else
|
||||
#define BLX "blx"
|
||||
#endif
|
||||
|
||||
static inline pthread_t __pthread_self()
|
||||
{
|
||||
extern hidden uintptr_t __a_gettp_ptr;
|
||||
register uintptr_t p __asm__("r0");
|
||||
__asm__ ( BLX " %1" : "=r"(p) : "r"(__a_gettp_ptr) : "cc", "lr" );
|
||||
return (void *)(p-sizeof(struct pthread));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define TLS_ABOVE_TP
|
||||
#define GAP_ABOVE_TP 8
|
||||
#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread))
|
||||
|
||||
#define MC_PC arm_pc
|
|
@ -1,32 +0,0 @@
|
|||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
#define ENDIAN_SUFFIX "eb"
|
||||
#else
|
||||
#define ENDIAN_SUFFIX ""
|
||||
#endif
|
||||
|
||||
#if __ARM_PCS_VFP
|
||||
#define FP_SUFFIX "hf"
|
||||
#else
|
||||
#define FP_SUFFIX ""
|
||||
#endif
|
||||
|
||||
#define LDSO_ARCH "arm" ENDIAN_SUFFIX FP_SUFFIX
|
||||
|
||||
#define NO_LEGACY_INITFINI
|
||||
|
||||
#define TPOFF_K 0
|
||||
|
||||
#define REL_SYMBOLIC R_ARM_ABS32
|
||||
#define REL_GOT R_ARM_GLOB_DAT
|
||||
#define REL_PLT R_ARM_JUMP_SLOT
|
||||
#define REL_RELATIVE R_ARM_RELATIVE
|
||||
#define REL_COPY R_ARM_COPY
|
||||
#define REL_DTPMOD R_ARM_TLS_DTPMOD32
|
||||
#define REL_DTPOFF R_ARM_TLS_DTPOFF32
|
||||
#define REL_TPOFF R_ARM_TLS_TPOFF32
|
||||
#define REL_TLSDESC R_ARM_TLS_DESC
|
||||
|
||||
#define TLSDESC_BACKWARDS
|
||||
|
||||
#define CRTJMP(pc,sp) __asm__ __volatile__( \
|
||||
"mov sp,%1 ; bx %0" : : "r"(pc), "r"(sp) : "memory" )
|
|
@ -1,103 +0,0 @@
|
|||
#define __SYSCALL_LL_E(x) \
|
||||
((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
|
||||
((union { long long ll; long l[2]; }){ .ll = x }).l[1]
|
||||
#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x))
|
||||
|
||||
#ifdef __thumb__
|
||||
|
||||
/* Avoid use of r7 in asm constraints when producing thumb code,
|
||||
* since it's reserved as frame pointer and might not be supported. */
|
||||
#define __ASM____R7__
|
||||
#define __asm_syscall(...) do { \
|
||||
__asm__ __volatile__ ( "mov %1,r7 ; mov r7,%2 ; svc 0 ; mov r7,%1" \
|
||||
: "=r"(r0), "=&r"((int){0}) : __VA_ARGS__ : "memory"); \
|
||||
return r0; \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
|
||||
#define __ASM____R7__ __asm__("r7")
|
||||
#define __asm_syscall(...) do { \
|
||||
__asm__ __volatile__ ( "svc 0" \
|
||||
: "=r"(r0) : __VA_ARGS__ : "memory"); \
|
||||
return r0; \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/* For thumb2, we can allow 8-bit immediate syscall numbers, saving a
|
||||
* register in the above dance around r7. Does not work for thumb1 where
|
||||
* only movs, not mov, supports immediates, and we can't use movs because
|
||||
* it doesn't support high regs. */
|
||||
#ifdef __thumb2__
|
||||
#define R7_OPERAND "rI"(r7)
|
||||
#else
|
||||
#define R7_OPERAND "r"(r7)
|
||||
#endif
|
||||
|
||||
inline long __syscall0(long n)
|
||||
{
|
||||
register long r7 __ASM____R7__ = n;
|
||||
register long r0 __asm__("r0");
|
||||
__asm_syscall(R7_OPERAND);
|
||||
}
|
||||
|
||||
inline long __syscall1(long n, long a)
|
||||
{
|
||||
register long r7 __ASM____R7__ = n;
|
||||
register long r0 __asm__("r0") = a;
|
||||
__asm_syscall(R7_OPERAND, "0"(r0));
|
||||
}
|
||||
|
||||
inline long __syscall2(long n, long a, long b)
|
||||
{
|
||||
register long r7 __ASM____R7__ = n;
|
||||
register long r0 __asm__("r0") = a;
|
||||
register long r1 __asm__("r1") = b;
|
||||
__asm_syscall(R7_OPERAND, "0"(r0), "r"(r1));
|
||||
}
|
||||
|
||||
inline long __syscall3(long n, long a, long b, long c)
|
||||
{
|
||||
register long r7 __ASM____R7__ = n;
|
||||
register long r0 __asm__("r0") = a;
|
||||
register long r1 __asm__("r1") = b;
|
||||
register long r2 __asm__("r2") = c;
|
||||
__asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2));
|
||||
}
|
||||
|
||||
inline long __syscall4(long n, long a, long b, long c, long d)
|
||||
{
|
||||
register long r7 __ASM____R7__ = n;
|
||||
register long r0 __asm__("r0") = a;
|
||||
register long r1 __asm__("r1") = b;
|
||||
register long r2 __asm__("r2") = c;
|
||||
register long r3 __asm__("r3") = d;
|
||||
__asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3));
|
||||
}
|
||||
|
||||
inline long __syscall5(long n, long a, long b, long c, long d, long e)
|
||||
{
|
||||
register long r7 __ASM____R7__ = n;
|
||||
register long r0 __asm__("r0") = a;
|
||||
register long r1 __asm__("r1") = b;
|
||||
register long r2 __asm__("r2") = c;
|
||||
register long r3 __asm__("r3") = d;
|
||||
register long r4 __asm__("r4") = e;
|
||||
__asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4));
|
||||
}
|
||||
|
||||
inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
|
||||
{
|
||||
register long r7 __ASM____R7__ = n;
|
||||
register long r0 __asm__("r0") = a;
|
||||
register long r1 __asm__("r1") = b;
|
||||
register long r2 __asm__("r2") = c;
|
||||
register long r3 __asm__("r3") = d;
|
||||
register long r4 __asm__("r4") = e;
|
||||
register long r5 __asm__("r5") = f;
|
||||
__asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4), "r"(r5));
|
||||
}
|
||||
|
||||
#define SYSCALL_FADVISE_6_ARG
|
||||
|
||||
#define SYSCALL_IPC_BROKEN_MODE
|
|
@ -1,11 +0,0 @@
|
|||
#define _DIRENT_HAVE_D_RECLEN
|
||||
#define _DIRENT_HAVE_D_OFF
|
||||
#define _DIRENT_HAVE_D_TYPE
|
||||
|
||||
struct dirent {
|
||||
ino_t d_ino;
|
||||
off_t d_off;
|
||||
unsigned short d_reclen;
|
||||
unsigned char d_type;
|
||||
char d_name[256];
|
||||
};
|
|
@ -1,134 +0,0 @@
|
|||
#define EPERM 1
|
||||
#define ENOENT 2
|
||||
#define ESRCH 3
|
||||
#define EINTR 4
|
||||
#define EIO 5
|
||||
#define ENXIO 6
|
||||
#define E2BIG 7
|
||||
#define ENOEXEC 8
|
||||
#define EBADF 9
|
||||
#define ECHILD 10
|
||||
#define EAGAIN 11
|
||||
#define ENOMEM 12
|
||||
#define EACCES 13
|
||||
#define EFAULT 14
|
||||
#define ENOTBLK 15
|
||||
#define EBUSY 16
|
||||
#define EEXIST 17
|
||||
#define EXDEV 18
|
||||
#define ENODEV 19
|
||||
#define ENOTDIR 20
|
||||
#define EISDIR 21
|
||||
#define EINVAL 22
|
||||
#define ENFILE 23
|
||||
#define EMFILE 24
|
||||
#define ENOTTY 25
|
||||
#define ETXTBSY 26
|
||||
#define EFBIG 27
|
||||
#define ENOSPC 28
|
||||
#define ESPIPE 29
|
||||
#define EROFS 30
|
||||
#define EMLINK 31
|
||||
#define EPIPE 32
|
||||
#define EDOM 33
|
||||
#define ERANGE 34
|
||||
#define EDEADLK 35
|
||||
#define ENAMETOOLONG 36
|
||||
#define ENOLCK 37
|
||||
#define ENOSYS 38
|
||||
#define ENOTEMPTY 39
|
||||
#define ELOOP 40
|
||||
#define EWOULDBLOCK EAGAIN
|
||||
#define ENOMSG 42
|
||||
#define EIDRM 43
|
||||
#define ECHRNG 44
|
||||
#define EL2NSYNC 45
|
||||
#define EL3HLT 46
|
||||
#define EL3RST 47
|
||||
#define ELNRNG 48
|
||||
#define EUNATCH 49
|
||||
#define ENOCSI 50
|
||||
#define EL2HLT 51
|
||||
#define EBADE 52
|
||||
#define EBADR 53
|
||||
#define EXFULL 54
|
||||
#define ENOANO 55
|
||||
#define EBADRQC 56
|
||||
#define EBADSLT 57
|
||||
#define EDEADLOCK EDEADLK
|
||||
#define EBFONT 59
|
||||
#define ENOSTR 60
|
||||
#define ENODATA 61
|
||||
#define ETIME 62
|
||||
#define ENOSR 63
|
||||
#define ENONET 64
|
||||
#define ENOPKG 65
|
||||
#define EREMOTE 66
|
||||
#define ENOLINK 67
|
||||
#define EADV 68
|
||||
#define ESRMNT 69
|
||||
#define ECOMM 70
|
||||
#define EPROTO 71
|
||||
#define EMULTIHOP 72
|
||||
#define EDOTDOT 73
|
||||
#define EBADMSG 74
|
||||
#define EOVERFLOW 75
|
||||
#define ENOTUNIQ 76
|
||||
#define EBADFD 77
|
||||
#define EREMCHG 78
|
||||
#define ELIBACC 79
|
||||
#define ELIBBAD 80
|
||||
#define ELIBSCN 81
|
||||
#define ELIBMAX 82
|
||||
#define ELIBEXEC 83
|
||||
#define EILSEQ 84
|
||||
#define ERESTART 85
|
||||
#define ESTRPIPE 86
|
||||
#define EUSERS 87
|
||||
#define ENOTSOCK 88
|
||||
#define EDESTADDRREQ 89
|
||||
#define EMSGSIZE 90
|
||||
#define EPROTOTYPE 91
|
||||
#define ENOPROTOOPT 92
|
||||
#define EPROTONOSUPPORT 93
|
||||
#define ESOCKTNOSUPPORT 94
|
||||
#define EOPNOTSUPP 95
|
||||
#define ENOTSUP EOPNOTSUPP
|
||||
#define EPFNOSUPPORT 96
|
||||
#define EAFNOSUPPORT 97
|
||||
#define EADDRINUSE 98
|
||||
#define EADDRNOTAVAIL 99
|
||||
#define ENETDOWN 100
|
||||
#define ENETUNREACH 101
|
||||
#define ENETRESET 102
|
||||
#define ECONNABORTED 103
|
||||
#define ECONNRESET 104
|
||||
#define ENOBUFS 105
|
||||
#define EISCONN 106
|
||||
#define ENOTCONN 107
|
||||
#define ESHUTDOWN 108
|
||||
#define ETOOMANYREFS 109
|
||||
#define ETIMEDOUT 110
|
||||
#define ECONNREFUSED 111
|
||||
#define EHOSTDOWN 112
|
||||
#define EHOSTUNREACH 113
|
||||
#define EALREADY 114
|
||||
#define EINPROGRESS 115
|
||||
#define ESTALE 116
|
||||
#define EUCLEAN 117
|
||||
#define ENOTNAM 118
|
||||
#define ENAVAIL 119
|
||||
#define EISNAM 120
|
||||
#define EREMOTEIO 121
|
||||
#define EDQUOT 122
|
||||
#define ENOMEDIUM 123
|
||||
#define EMEDIUMTYPE 124
|
||||
#define ECANCELED 125
|
||||
#define ENOKEY 126
|
||||
#define EKEYEXPIRED 127
|
||||
#define EKEYREVOKED 128
|
||||
#define EKEYREJECTED 129
|
||||
#define EOWNERDEAD 130
|
||||
#define ENOTRECOVERABLE 131
|
||||
#define ERFKILL 132
|
||||
#define EHWPOISON 133
|
|
@ -1,40 +0,0 @@
|
|||
#define O_CREAT 0100
|
||||
#define O_EXCL 0200
|
||||
#define O_NOCTTY 0400
|
||||
#define O_TRUNC 01000
|
||||
#define O_APPEND 02000
|
||||
#define O_NONBLOCK 04000
|
||||
#define O_DSYNC 010000
|
||||
#define O_SYNC 04010000
|
||||
#define O_RSYNC 04010000
|
||||
#define O_DIRECTORY 0200000
|
||||
#define O_NOFOLLOW 0400000
|
||||
#define O_CLOEXEC 02000000
|
||||
|
||||
#define O_ASYNC 020000
|
||||
#define O_DIRECT 040000
|
||||
#define O_LARGEFILE 0100000
|
||||
#define O_NOATIME 01000000
|
||||
#define O_PATH 010000000
|
||||
#define O_TMPFILE 020200000
|
||||
#define O_NDELAY O_NONBLOCK
|
||||
|
||||
#define F_DUPFD 0
|
||||
#define F_GETFD 1
|
||||
#define F_SETFD 2
|
||||
#define F_GETFL 3
|
||||
#define F_SETFL 4
|
||||
|
||||
#define F_SETOWN 8
|
||||
#define F_GETOWN 9
|
||||
#define F_SETSIG 10
|
||||
#define F_GETSIG 11
|
||||
|
||||
#define F_GETLK 12
|
||||
#define F_SETLK 13
|
||||
#define F_SETLKW 14
|
||||
|
||||
#define F_SETOWN_EX 15
|
||||
#define F_GETOWN_EX 16
|
||||
|
||||
#define F_GETOWNER_UIDS 17
|
|
@ -1,10 +0,0 @@
|
|||
#define FE_ALL_EXCEPT 0
|
||||
#define FE_TONEAREST 0
|
||||
|
||||
typedef unsigned long fexcept_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned long __cw;
|
||||
} fenv_t;
|
||||
|
||||
#define FE_DFL_ENV ((const fenv_t *) -1)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue