Feature/connect frontend to backend v1 2#25
Merged
Jaymyong66 merged 8 commits intofeature/backend-v1-2from Apr 3, 2026
Merged
Conversation
tain030
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. 백엔드 변경 설명
backend/src/oracle/program_accounts.rs — MasterPolicy 파싱 오프셋 버그 수정
문제: parse_master_policy()에서 온체인 MasterPolicy 계정의 oracle_feed: Pubkey 필드(32바이트)를 읽지
않고 건너뛰어, 이후 status, created_at, bump 필드가 32바이트 밀린 위치에서 읽혔습니다.
증상:
원인: 온체인 state.rs의 MasterPolicy 구조체에 oracle_feed: Pubkey 필드가 participants 뒤, status 앞에
있는데, program_accounts.rs의 파서가 이 필드를 누락했습니다.
// state.rs (온체인)
pub struct MasterPolicy {
...
pub participants: Vec,
pub oracle_feed: Pubkey, // ← 이 필드가 파서에 없었음
pub status: u8,
pub created_at: i64,
pub bump: u8,
}
수정: MasterPolicyInfo 구조체에 oracle_feed: String 추가, parse_master_policy()에서 read_pubkey() 호출
추가.
backend/src/api.rs — CORS 설정 추가
문제: 프론트엔드(localhost:5173)에서 백엔드(localhost:3000)로의 fetch/EventSource 요청이 CORS 정책에
의해 차단되었습니다.
증상: 브라우저 네트워크 탭에서 flight-policies, events 요청이 CORS error로 실패.
수정: tower-http의 CorsLayer를 라우터에 추가. Cargo.toml에 이미 tower-http = { features = ["cors"] }가
있었으나 사용되지 않고 있었습니다.
let cors = CorsLayer::new()
.allow_origin(Any)
.allow_methods(Any)
.allow_headers(Any);
let app = router::build_router(state).layer(cors);
▎ 참고: 프로덕션에서는 allow_origin(Any) 대신 특정 도메인으로 제한해야 합니다.
2. 프론트엔드 변경사항
Summary
useMyPolicies훅을 직접 Solana RPC에서 백엔드 REST API(GET /api/master-policies)로 전환MasterPolicySummary타입에statusLabel필드 추가하여 백엔드의status_label활용Changes
타입 수정
useMasterPolicyAccount.ts:BackendMasterPolicy에서bump제거 →status_label추가, 변환 시bump: 0하드코딩useFlightPolicies.ts:BackendFlightPolicy에서bump제거 →status_label추가, 변환 시bump: 0하드코딩
useMasterPolicies.ts:BackendMasterPolicyItem에status_label추가useProtocolStore.ts:MasterPolicySummary에statusLabel필드 추가useMyPolicies 리팩터링
prog.account.masterPolicy.all()+ memcmp 필터) →GET /api/master-policies백엔드API
문서
docs/TRACK_B_SSE_MIGRATION_ROADMAP.md: 레거시 Policy 훅 현황 및 향후 전환 참고docs/TESTING_AND_DEPLOYMENT_GUIDE.md: 로컬 테스트 시나리오 8개 + Docker 배포 가이드Test plan
npx tsc --noEmit타입 체크 통과 확인curl /api/master-policies에서status_label,oracle_feed정상 반환 확인useMyPolicies가 백엔드 API 경유로 정책 목록 표시